question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cancel animationFrame?

See original GitHub issue

Hi,

I have this bit of code:

render(){

    requestAnimationFrame(this.render.bind(this));

    this.tl
        .to(this.displacementFilter.scale, 1, { x: 75, ease: Power2.easeInOut })
        .to(this.displacementFilter.scale, 1, { x: 0, ease: Power2.easeInOut });

    this.renderer.render(this.stage);

}

I am using Greensock (GSAP) to tween the scale.x property of a filter, however, I just want this to be played once. So how can I render this, and cancel rAF when the tweening is done? Any tips?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Aug 30, 2016

Hi, You shouldn’t put your timeline tweens in the render loop, it will create a new tween 60 times a second! You just need to put the tween somewhere else where it’s only called once. Also, TweenLite provide an “onUpdate” callback that is called 60 times a second for the duration of the tween, so if you only want to render your scene while the scale is animated, you can put the above code in that callback.

0reactions
lock[bot]commented, Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

window.cancelAnimationFrame() - Web APIs | MDN
The window.cancelAnimationFrame() method cancels an animation frame request previously scheduled through a call to window.
Read more >
cancelAnimationFrame · WebPlatform Docs
cancelAnimationFrame. Summary. Cancels a requestAnimationFrame request. Method of dom/Windowdom/Window. Syntax. window.cancelAnimationFrame(/* see parameter ...
Read more >
Right usage of requestAnimationFrame / cancelAnimationFrame
You should send the id of the requestAnimationFrame you want to cancel into cancelAnimationFrame . That id is a return value of the...
Read more >
cancelAnimationFrame - Cesium Documentation
cancelAnimationFrame (requestID). A browser-independent function to cancel an animation frame requested using requestAnimationFrame .
Read more >
"cancelanimationframe" | Can I use... Support tables for ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found