[vtkusers] Animation (was Re: VRMLServer examples)
Sebastien BARRE
seb-ml-vtk at barre.nom.fr
Mon Dec 4 08:55:22 EST 2000
At 04/12/2000 14:25, Christian Poecher wrote:
>Info on video creation is on:
>http://www.rug.nl/hpc/VTK/vtk/output/man.html
If someone wants to implement basic animation stuff, I'd also advise to
look at KeyBottle and stuff. Then implement something running asynchronously.
For example, I made two classes : KeyFramers are used to record or set the
parameters of whatever VTK object. They maintain a list of valued keys and
interpolate between them using splines. Usual stuff.
They are registred to a KeyScheduler that is used to drive the animation :
on recording, it asks each KeyFramer to record a new value key
asynchronously (say for example, 5 times by second). On playing, it asks
them to interpolate the parameters (say, 30 times by second). It's a bit
more tricky : you do not ask the exact number of frame per sec. on playing,
but the duration of the recorded animation to playback : then, it will use
the fastest possible framerate and adjust it during the animation so that
it wil never be late. That's the big picture. Not a big deal anyway. It
someone is interested, I might clean it up and give it away next year.
It looks like this :
set viewport [lindex [$widget get_viewports] 0]
set camera [$viewport GetActiveCamera]
::sb::vtkoo::KeyFramer keyfpos \
-runmethod "$camera SetPosition" \
-recordmethod "$camera GetPosition" \
::sb::vtkoo::KeyFramer keyffp \
-runmethod "$camera SetFocalPoint" \
-recordmethod "$camera GetFocalPoint" \
::sb::vtkoo::KeyScheduler keys \
-runfps 25 \
-recordaps 5 \
-messagecommand {set ::messagevar %s} \
-runprogressvar ::messagevar \
-runcallback "$widget camera_has_changed $viewport ; $widget
render $viewport"
keys insert_child end keyfpos keyffp
bind $d <Key-F1> {keys run}
bind $d <Key-F2> {keys stop}
bind $d <Key-F6> {keys record -duration 60000}
More information about the vtkusers
mailing list