I have an assignment to do which includes animation a stick man (stick figure) such that it can move its hands and legs and possibly also change the colour of it face. Is there a possibility to do this? Thanks for any help to be provided.

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 2월 27일

0 개 추천

Yes. Create a bunch of lines using line(). Then modify their xdata and ydata properties to reflect new positions. You could do this with a for-loop and a pause() or even better with a timer().

댓글 수: 6

Abhishek
Abhishek 2012년 2월 27일
How can I make it's face which need to be round or elliptical?
Sean de Wolski
Sean de Wolski 2012년 2월 27일
You could use some rectangles:
doc rectangle
or change the markers on a line to be the shape/size/color/position you need. See:
doc linespec
If you have Simulink 3d, you could use some of those objects too, though I would guess that is outside the scope of your project.
Abhishek
Abhishek 2012년 2월 27일
Thank you very much for that. just one last question how can delete a line? i am basically trying to make its face go smaller and bigger so i want to delete the previous line(using line command as a point for his face and altering its marker size) so that only the new one is drawn?
Thanks
Sean de Wolski
Sean de Wolski 2012년 2월 27일
h = line;
delete(h)
Abhishek
Abhishek 2012년 2월 28일
thank you vey much much appreciate your help and guidance.
In R2014b there is an animatedLine function:
Create an animated line with two initial points.
x = [1 2];
y = [1 2];
h = animatedline(x,y);
Add points to the line in a loop to create an animation of a growing line. See Using animatedline Objects for more information.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

제품

태그

질문:

2012년 2월 27일

댓글:

2015년 1월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by