[vtkusers] VTK animation under VTK-Web framework

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Aug 2 13:42:41 EDT 2016


You have several options, but the simple one is to add a new rpc method on
the server side that will move to the next "step", and then on the client
side you can call that method at a given interval and asking for a render
right after it.

## Server

    @exportRpc("next.step")
    def next(self):
       # Do your stuff for animation
       pass

## Client

setInterval( function() {
   connection.session.call('next.step')
       .then(function() {
           viewport.render()
       });
}, 1000)


On Tue, Aug 2, 2016 at 2:37 AM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:

> ​​Hi all,
>
>
> I saw Bryan Conrad provided us a practical example on VTK animation (
> https://itk.org/Wiki/VTK/Examples/Python/Animation​). Now, I'd like to
> refer this example to animate objects (e.g. sphere or cone) under VTK-Web
> framework (e.g. vtk_web_cone.py). As far as I know, "TimerEvent" is used as
> a timer to trigger an event repeatedly, and this timer is bound to
> renderWindowInteractor by AddObserver. However, in vtk_web_cone.py, it
> seems that web server is waiting after the renderWindow is set as an active
> object. How can I start the timer? How to integrate the example into
> vtk_web_cone.py? Any suggestions are welcomed. Thanks in advance​.
>
>
>
> Regards,
>
>
> Zhuangming Shen
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160802/9d7dbde8/attachment.html>


More information about the vtkusers mailing list