Giter VIP home page Giter VIP logo

Comments (12)

gskinner avatar gskinner commented on July 17, 2024

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.

Robinfr avatar Robinfr commented on July 17, 2024

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.

gskinner avatar gskinner commented on July 17, 2024

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.

Robinfr avatar Robinfr commented on July 17, 2024

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.

gskinner avatar gskinner commented on July 17, 2024

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.

Robinfr avatar Robinfr commented on July 17, 2024

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.

gskinner avatar gskinner commented on July 17, 2024

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.

Robinfr avatar Robinfr commented on July 17, 2024

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.

gskinner avatar gskinner commented on July 17, 2024

Just use:
myTimeline.paused = true

from tweenjs.

Robinfr avatar Robinfr commented on July 17, 2024

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.

gskinner avatar gskinner commented on July 17, 2024

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.

Robinfr avatar Robinfr commented on July 17, 2024

Alright, thanks for the info!

from tweenjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.