def draw(self, *args): """Redraw the whole app.""" self.ctx.clear() for obj in self.objects[::-1]: obj.update() obj.draw() window.requestAnimationFrame(self.draw)
def anim_rot_loop(self, ts): has_chg, rot = self.get_anim_ref(ts, self.params['anim_step']) if has_chg and self.params['anim']: self.params['rotate'] = rot self.transform() if self.params['anim']: window.requestAnimationFrame(self.anim_rot_loop)
def animate(i): # note: three.js includes requestAnimationFrame shim window.requestAnimationFrame(animate) controls.update() mesh.rotation.x += 0.01 # mesh.rotation.y += 0.02; renderer.render(scene, camera)
def on_update(data, ack): data = JSON.parse(data) Game().updates = data['updates'] Game().new_bots = data['bots'] Game().time = data['time'] Game().started = data['started'] window.requestAnimationFrame(Game().draw) ack()
def anim_path_loop(self, ts): has_chg, pt = self.get_anim_ref(ts, self.params['anim_step']) if has_chg and self.params['anim']: x, y = pt self.elm.left = x self.elm.top = y if self.params['anim']: window.requestAnimationFrame(self.anim_path_loop)
def drawFrame(timestamp): global tsave, nxt if nxt < 200: window.requestAnimationFrame(drawFrame) if tsave == 0.0: tsave = timestamp else: displayPic2(timestamp - tsave) #,v,ctx,frames,q)
def draw(self, *args): """Redraw the whole app.""" self.ctx.clear() for circle in self.excentrics: self.ctx.beginFill(circle.color, circle.opacity) self.ctx.drawCircle(circle.x, circle.y, circle.r) self.ctx.endFill() circle.update() window.requestAnimationFrame(self.draw)
def anim_scl_loop(self, ts): has_chg, pt = self.get_anim_ref(ts, self.params['anim_step']) if has_chg and self.params['anim']: x, y = pt self.params['scaleX'] = x / 100.0 self.params['scaleY'] = y / 100.0 self.transform() if self.params['anim']: window.requestAnimationFrame(self.anim_scl_loop)
def drawFrame(timestamp): window.requestAnimationFrame(drawFrame) ctx.clearRect(0, 0, canvas.width, canvas.height) ctx.strokeRect(0, 0, canvas.width, canvas.height) ctx.fillStyle = "#99f9ea" ctx.fillRect(0, 0, canvas.width, canvas.height) """ Draw shapes and update """ for s in shapeList: s.draw(ctx) s.update(timestamp)
def animate(i): # note: window.THREE.js includes requestAnimationFrame shim window.requestAnimationFrame( animate ) #mesh.rotation.x += 0.05 #mesh.rotation.y += 0.1 doc["console"].value = "" print("forearm.rotation.z:", forearm.rotation.z) print("forearm.rotation.y:", forearm.rotation.y) forearm.rotation.y += 0.1 forearm.rotation.z += 0.1 renderer.render( scene, camera )
def request_animation_frame(func): return int(window.requestAnimationFrame(func))
def render(): global direction window.requestAnimationFrame(render) renderer.render(scene, camera)
def animloop(t): global run run = window.requestAnimationFrame(animloop) render()
def desenhar(self, *args): self.ctx.clearRect(0, 0, canvas.width, canvas.height) for objeto in self.objetosDesenhados: objeto.desenhar() window.requestAnimationFrame(self.desenhar)
def queue(self): window.requestAnimationFrame(self.loop)
def init_anim(self, ar, f): self.params['anim_ar'] = ar self.params['anim'] = True self.params['refts'] = None self.backup_state() window.requestAnimationFrame(f)
def refresh(self): window.requestAnimationFrame(self._refresh)
def animate(i): window.requestAnimationFrame( animate ) forearm.rotation.y += 0.1 forearm.rotation.z += 0.1 renderer.render( scene, camera )