Comments (12)
I just tested this and it seems to be working fine with the latest. Could you please provide more information or a reproduction case? Please re-open this issue if you are able to repro.
Here's a fiddle showing it working:
https://jsfiddle.net/4gfwt82a/
from tweenjs.
I'm sorry, the paused
property does work. But the removeTweens
function doesn't work. I'm expecting that if call that function, it should stop tweening as well, but it doesn't.
E.g.: https://jsfiddle.net/4gfwt82a/1/
from tweenjs.
Hmm. I just tested your fiddle in Chrome, Firefox, and Safari, and it seems to work properly. For example, here's the output from Chrome 58:
10.365999999999998
20.868999999999993
30.92399999999999
40.97099999999999
// stopped at ~40 as expected.
https://jsfiddle.net/4gfwt82a/2/ (updated to use rawgit)
Is this happening only in a specific browser or something?
from tweenjs.
No, I'm also using Chrome 58. I find it very strange that it does work for you.. Is it possible that this is because I'm tweening a setter on an instance of an ES6 class?
from tweenjs.
What result are you seeing on the fiddle?
If you are using a transpiler that seals the instance you are tweening, that could cause a problem, but otherwise I can't think of any reason tweening a setter on an ES6 class instance would cause an issue.
from tweenjs.
It seems to the problem with the timeline, I've updated the Fiddle to my exact problem: https://jsfiddle.net/4gfwt82a/3/
There doesn't seem to be any way to remove the tweens that are added to a timeline from an object.
from tweenjs.
Ok. This is expected behaviour, but I can definitely see the confusion. When a tween is added to a timeline it is paused, and then advanced "manually" by the timeline. Since it's already paused, calling removeTweens doesn't do anything (it effectively just pauses the tweens). The workaround is to remove the tween from the timeline, or decouple the tween from its target.
In the new version of TweenJS I added a _parent
property, which could potentially make it possible to make this work the way you expected, but I have to be very careful to avoid memory leaks through excess references.
from tweenjs.
Hmm alright, so in case I would want to dispose of a timeline and stop all of its tweens, how would I go about doing that?
from tweenjs.
Just use:
myTimeline.paused = true
from tweenjs.
This is what I'm doing at the moment, but does this actually clean up the tweens or does it leave objects in memory? I need a way to fully dispose of the timeline and the tweens in the timeline so they are no longer in memory.
from tweenjs.
as long as you do not retain any direct references to the timeline or tweens in your own code then pausing the timeline is sufficient to stop all execution and free it for garbage collection.
from tweenjs.
Alright, thanks for the info!
from tweenjs.
Related Issues (20)
- TypeError: compareComp is undefined HOT 1
- Tweening 2+ objects cause page crashing after changing tabs HOT 17
- How to use Ease Class in my Tween function?
- Tween loops get stuck when do update duration in the middle of the loop HOT 1
- Make a slot Effect HOT 1
- npm main field wrong HOT 1
- Get all Tweens at once HOT 3
- Animation exported from Animate CC is choppy when stage area is below certain value HOT 3
- How do I tween this data format? HOT 2
- Feature Request | Possbility of changing color of only a paticular word in Text Class text
- Feature Request | Possibility request for adding a particular word different color in text class HOT 4
- clip HOT 1
- 图形滚动 HOT 1
- Movieclip autoReset causes frame actions to be executed in reverse order when movieclip is reset
- Tween._inited does not reset if scene is being destroyed or removed inside the game and rebuild HOT 1
- Tick listener and GetContext Error HOT 5
- HTML5 Canvas on Adobe Animate CC: Tweening any object to 0 causes all objects with mouse events to not respond anymore HOT 1
- Documentation: AbstractTween.paused is not read only HOT 1
- Documentation: Tween.addLabel() should be Tween.label() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tweenjs.