Coder Social home page Coder Social logo

n00b frustrated with TweenJS about tweenjs HOT 5 CLOSED

createjs avatar createjs commented on August 14, 2024
n00b frustrated with TweenJS

from tweenjs.

Comments (5)

lannymcnie avatar lannymcnie commented on August 14, 2024

Hi @gilbi

Thanks for your comments - hopefully I can answer some of them:

  1. setProps works in examples that I have tested. Can you provide a sample of it not working?
    Here is a simple demo of it working.
    http://jsfiddle.net/lannymcnie/s6Rxe/1/
  2. The play function and setPaused are totally different APIs. setPaused is an immediate "stop the tween" function, whereas the play function queues up a "play" action in the current tween queue, which will start a different tween that is currently paused.
// Create a tween, and pause it
var tween1 = createjs.Tween.get(target).to({y:100}, 2000);
tween1.setPaused(true);
// Create another tween. When it is done its first "to" action, it will call play on the first tween.
createjs.Tween.get(target)
    .to({x:100}, 2000)
    .play(tween1);
  1. You are correct, we should change the docs. Mainly you will not get any performance increase from caching a Bitmap, whereas you do from other DisplayObject types.
  2. Thanks for the heads up, I have corrected the documentation, marking this as required. It was just an oversight.

Cheers.

from tweenjs.

gilbox avatar gilbox commented on August 14, 2024

@lannymcnie,

Thank you for your illuminating explanation re: setPaused.

Here is an example where set(...) does not do what I would expect:

http://jsfiddle.net/s6Rxe/20/

(In the example above, I want the text to move from x=200 to x=0 in 2000ms.)

from tweenjs.

lannymcnie avatar lannymcnie commented on August 14, 2024

Definitely a bug or unexpected behaviour.

Looks like properties updated using the set() API get overridden by tween properties, which are stored in an internal look up to manage the tween.

A workaround would be to use a 0-duration tween instead of a set - but we will look into fixing this issue if possible.

createjs.Tween.get(target).to({x:100}, 0).to(etc...)

Thanks for the report!

from tweenjs.

lannymcnie avatar lannymcnie commented on August 14, 2024

I distilled the example down to this to show the issue
http://jsfiddle.net/lannymcnie/s6Rxe/22/

from tweenjs.

lannymcnie avatar lannymcnie commented on August 14, 2024

I discussed this issue internally, and its behaving as expected. TweenJS uses managed properties to make tweens deterministic. The "set" method will only set properties once, but managed properties will always override them. To do an instant set of a managed property, use a "to" call (as in the demo above).

Thanks for your comments.

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.