How to properly define a function handle for fanimator

7 views (last 30 days)
Hey, I would like to use fanimator to build some animations. Here is my problem with it:
In the documentation of fanimator a new call to it is invoked whenever a new part of the animation is defined. In the example a point and a circle are animated and therefore they use fanimator 2 times, once for the point and once for the circle. Now let's say I would like to animate something more complex, with several rectangles, points, circles etc. Is there some neat way to define a function, say complexDrawing, which you can use as a parameter for fanimator, so you only have to call it once and not for every rectangle, point, circle, etc. of the drawing?
To make this more concrete, how would you do that with the example from the documentation?
So instead of
f = @(t) plot(t,1,'r*');
fanimator(f)
syms t x
hold on
fanimator(@fplot,cos(x)+t,sin(x)+1,[-pi pi])
axis equal
hold off
I would like to have something like
fanimator(@(t) complexDrawing(t))
where the point and the circle are defined in complexDrawing. How can this be done? In case this is currently impossible to do by the use of fanimator. What would be the "right way" to animate a more complex drawing in MATLAB?

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!