Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
caffrey75

TweenMax fromTo with css properties

Recommended Posts

Sorry this is probably a really newb question, but can somebody help with the correct syntax for tweening css properties using fromTo (or is this not possible)?

 

TweenMax.fromTo($(".obj"),1,{css:{left:50, top: 10}, css{left:0, top: 50}});

 

I've been messing around adding and deleting curly brackets for ages, but the console just throws an error every time and I can't seem to find anything in documentation to give me a better clue.

 

Thanks for any help in advance - GSAP really is an awesome work! :)

Link to post
Share on other sites

EDIT:

 

Apologies, I cried for help too soon and found the answer. Seems it wasn't a curly bracket configuration issue, but the fact that I wasn't putting my values in quotes.

 

The correct way should have been:

 

TweenMax.fromTo($(".obj"), 1, {css: {left: "900", top: "300"}}, {css:{left:"0", top: "0"}});

Link to post
Share on other sites

Actually, the problem was with your curly braces. It's fine if the values aren't in quotes (well, unless they're not numbers, like "rgb(10,200,51)" or "50%" or relative values like "+=50px", etc.). Glad you figured it out though. Happy tweening!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×