Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TWEEN is undefined" #64

Closed
aprilcarter opened this issue Mar 21, 2015 · 6 comments
Closed

"TWEEN is undefined" #64

aprilcarter opened this issue Mar 21, 2015 · 6 comments
Labels

Comments

@aprilcarter
Copy link

When I try to reference the TWEEN class in my code, I get an "Uncaught ReferenceError" saying that TWEEN is undefined. I have used the TweenJS CDN, the CreateJS CDN, the minified and the unminified file locally, and searched through countless examples to try and find out where I am going wrong. The line I get the error on is:

var tween = new TWEEN.Tween(location);

When I use the CreateJS CDN, the browser has no trouble with "new createjs...", but I just cannot get TweenJS to work.

@gskinner
Copy link
Member

Where are you finding a reference to an object named "TWEEN"? Is it in the docs or examples somewhere? Tween is inside the createjs object:

createjs.Tween.get(target).to({x:100}, 1000);

@aprilcarter
Copy link
Author

I did notice in the docs that you always used createjs. I am going off of the blog post "Advanced animation path" and other blog posts like it. I did try createjs, though, and it got me past the object reference, but then I get "undefined is not a function" on every method after ".to()". I will remove one method, and the error simply moves to the next one down the list.

@lannymcnie
Copy link
Member

It may have been an old blog post (more than 3 years). Have a look at the documentation and examples, and post questions to StackOverflow (this forum is for reporting issues).

Cheers!

@aprilcarter
Copy link
Author

I have looked through examples and documentation from this forum. I still end up with the error "undefined is not a function" on the methods I use, no matter what I use.

@gskinner
Copy link
Member

Try starting with these demos:
http://createjs.com/Demos/TweenJS/Tween_Circles

You can view and edit the code using the tab at the bottom right.

@aprilcarter
Copy link
Author

Thanks! It turns out, I was getting this mixed up with another library called tweenjs that does use an object called TWEEN. I was using your CDN, (because I assumed your site belonged to the other tweenjs), and getting the methods all mixed up going back and forth between the two libraries' documentation. I was using their methods with your object. I can't believe I missed that they were two separate libraries for so long. The fact that the TWEEN object comes back as undefined even when I am referencing the right files means that I will probably try to work out how to do what I want with createjs before trying to figure out why TWEEN isn't working. It seems like this tween library is more complete as well. In the end, I'm glad I made the mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants