[SOLVED] Tween Manager Error

Hi, for no apparent reason Im suddenly getting the error:

tabs=135357229&line=704&col=21&error=true): Uncaught TypeError: application.addTweenManager is not a function

I am not working on any tweens and all I recall doing prior to the error was creating some folders in my project and organizing some files. I have tried re-uploading the script, restarting my Pc etc but the error persists.

What can it be and how can I resolve it?
Thanks

We’re on it, stay tuned.

1 Like

The error seems to have gone away. :slight_smile:

1 Like

I have this error now

You need to delete your currunt tween thingy and download a new one from the asset store.

2 Likes

where is this asset store?

You can find the Asset Store button in the editor, on the bottom right of your scene.

Indeed! Found it! Thanks!

2 Likes

I’ve been having this error [in local development] for the past month, have been ignoring it but trying now to get rid of it.

I’ve deleted the “tween animation library” folder from the folder hierarchy, then re-downloaded it from the Asset Store, but the error persists.

Any tips? :slight_smile: @Albertos

Hi @Michaelsking1993 and welcome!

Can you please show your error?

1 Like

I’m not sure what could be the problem.

Maybe you can try to import it from the page below.

How do I phyically import it from github? What does that mean? :thinking: (sorry if that is a dumb question, it’s just not apparent to me at first or second thought :slight_smile: )

Hi @Michaelsking1993,

You can download the tween.js script from the repo and upload it to your PlayCanvas project.

Or you can import the tween library using from the PlayCanvas Asset Store, there is button to the top right of your assets panel.

1 Like

I find that after an update with new tweener.js the .start() function must be placed before the .on(‘complete’…‘update’… and other events.
Code like this:

this.entity
.tween(…)
.to(…)
.on(‘complete’,function(){…})
.start();

  • will make error

this.entity
.tween(…)
.to(…)
.start()
.on(‘complete’,function(){…});

  • will work properly

The github overview (GitHub - playcanvas/playcanvas-tween: A tween library for PlayCanvas) now includes events like onComplete, onUpdate rather than .on(‘complete’,…) . I have tested them and there is no error when onComplete is before .start() in this kind of animation call.

Hi @Andrew_S and welcome!

Probably it looks like this work properly, because you exclude .on() (which is not working anymore) from the tween. Instead you need to update the code and use .onComplete().

1 Like

I think on() is now deprecated, but it still works. I tested it. In the placanvas animation examples (Using the Tween library | Learn PlayCanvas) it is still used.
(project - PlayCanvas | HTML5 Game Engine,
code - PlayCanvas | HTML5 Game Engine

  this.tween.on('update', function () {
      this.entity.model.material.diffuse = this.tweenedProperties.diffuse;
      this.entity.model.material.update();
  }.bind(this));

)

I think this page still need to be updated, but if it works for you you’re in luck! :four_leaf_clover:

But updaitng the code is a good idea :slight_smile:

I created an issue to get this manual page updated:

1 Like