Jump to content
GreenSock

ehow

Using a predefined css rule as an animation parameter

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,

 

I'd like to know if its possible to use TweenMax/Lite with a predefined CSS rule, something like this:

 

.someClass

{

     left: 20px;

     top: 50px;

}

 

TweenLite.to( myDomElement, 0.5, { someClass });

 

In this way I could lay out a bunch of scenarios and animate to them as needed.

 

Thanks!

Link to comment
Share on other sites

Hi! Welcome to the GreenSock forums.

 

You can tween a classname

 

 

.sample{
background-color:#f00;
width:200px;
}

TweenLite.to(myElement, 1,{className:"sample"});

 

 

Please see the getting started guide and the CSSPlugin docs for more info.
http://www.greensock.com/get-started-js/
http://api.greensock.com/js/com/greensock/plugins/CSSPlugin.html

Link to comment
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.
×