MCPcopy Create free account
hub / github.com/Kitware/VTK / animate

Method animate

Web/Python/vtkmodules/web/protocols.py:378–400  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

376 )
377
378 def animate(self):
379 if len(self.viewsInAnimations) == 0:
380 return
381
382 nextAnimateTime = time.time() + 1.0 / self.targetFrameRate
383 for vId in self.viewsInAnimations:
384 self.pushRender(vId, True)
385
386 nextAnimateTime -= time.time()
387
388 if self.targetFrameRate > self.maxFrameRate:
389 self.targetFrameRate = self.maxFrameRate
390
391 if nextAnimateTime < 0:
392 if nextAnimateTime < -1.0:
393 self.targetFrameRate = 1
394 if self.targetFrameRate > self.minFrameRate:
395 self.targetFrameRate -= 1.0
396 schedule_callback(0.001, lambda: self.animate())
397 else:
398 if self.targetFrameRate < self.maxFrameRate and nextAnimateTime > 0.005:
399 self.targetFrameRate += 1.0
400 schedule_callback(nextAnimateTime, lambda: self.animate())
401
402 @exportRpc("viewport.image.animation.fps.max")
403 def setMaxFrameRate(self, fps=30):

Callers 1

startViewAnimationMethod · 0.95

Calls 2

pushRenderMethod · 0.95
timeMethod · 0.80

Tested by

no test coverage detected