Using Tween.js for Simple Animations

  • Hello, 

    I'm trying this solution to create simple animation, but following your tuto, I get an error in the console. What did I miss? 

    Thank you

  • Hi Keven, I suspect you didn't add the Tween.JS script to your scene. 

    • Create a new empty object
    • Add a script component
    • Add Tween.JS to the script component
    • Select initialized from the event dropdown

    If it still happens, it might be an order of operations problem. Trying moving the script you're trying to use Tween.JS with to the event "Lens Turned On" which happens after Initialized. This will let Tween.JS initialize and be ready to use prior to you using it. 

  • Well, I did have the script in my scene, but it seems I did not name it correctly, now that I have deleted the previous object and create a new one with the proper name, it's working. 

    Thank you. 

    Time to figure out, how to tweak to do what I want, which is creating a baseball bat movement. 

  • Hi Travis, thanks so much for putting the TweenJS integration, it's super helpful. 


    Just a quick note, at some point, shouldn't it be natively integrated in the main scripting API?

    In other 3d frameworks, there's usually a way to create animations programmatically on scene objects directly, which is a good middle ground between having to create all the animations in your 3d modeling tool, or modifying the objects' parameters manually on each frame (which is essentially what TweenJS is doing, if I'm not mistaken).

    Anyways, would love to hear your thoughts!

  • Also I added type definitions for the TweenManager to my Lens scripting api typings on Github;



    It's pretty helpful.

    Thanks for the nice tool!

Have a comment?

Please sign in to leave a comment.