-
Notifications
You must be signed in to change notification settings - Fork 84
Animation
tranimate
is based on a fairly general framework implemented by Animate.py
for 2D or 3D animation.
Instead of conventional matplotlib plotting
ax.plot(1,2)
we do this
anim = Animate(ax)
anim.plot(1,2)
which adds a line plot to the display list.
The Animate object mimics the behaviour of an Axis3D
or Axis
object and supports methods:
matplotlib primitive | display list object |
---|---|
plot() |
_Line |
text() |
_Text |
quiver() |
_Quiver |
The object is drawn to the axes using the equivalent matplotlib commands, but the parameters and a handle to the Artist are kept in an object in the display list.
The display list has a __repr__
method which shows the display list content.
The A._draw(T)
transforms the parameters of every item in the display list and renders them to the canvas. It does this by invoking the draw(T)
method for every item in the display list.
This assumes that all objects are drawn as if they were at the identity pose.
The run()
method uses matplotlib animation machinery, FuncAnimation
, to which provides an event handler to step the animation. That handler gets the next transform and uses _draw(T)
to display the object.
-
Multiple independently moving objects could be handled by separate display lists, but the event handler would need to be update to allow this.
-
Extend the supported primitives to include points (scatter) and patches.