How to animate a stick figure?

13 ビュー (過去 30 日間)
sarah covert
sarah covert 2019 年 12 月 13 日
回答済み: Divya Yerraguntla 2020 年 1 月 13 日
I need to make this stick figure move left and right, and up and down. It should be an animation that shows the stick figure sliding along the x axis, likely using linspace for a time vector.
Here is the code for the stick figure:
joints = [-0.5 .9; -0.4 1.2; -0.2 1.4; 0.0 1.4; 0.2 1.4; ...
0.4 1.2; 0.3 .85; 0.0 1.6; -0.5 0.0; -0.4 0.0; ...
-0.3 0.5; 0.0 0.9; 0.3 0.5; 0.5 0.0; 0.7 0.0];
bones1 = [ 1 2; 2 3; 3 4; 4 5; 5 6; 6 7; 4 8; ...
4 12; 9 10; 10 11; 11 12; 12 13; 13 14; 14 15];
for k=1:size(bones1,1)
plot([joints(bones1(k,1),1), joints(bones1(k,2),1)], [joints(bones1(k,1),2), joints(bones1(k,2),2)])
hold on
end
plot(joints(:,1), joints(:,2), 'o')

回答 (1 件)

Divya Yerraguntla
Divya Yerraguntla 2020 年 1 月 13 日
Have a look at this function to create animated lines in MATLAB:

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by