Jump to content
GreenSock

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

Using a timeline to act upon multiple elements simeltaneously

Go to solution Solved by Shaun Gorneau,

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'm new to GSAP. This is just a syntax question, I think:

 

I have two images that need to be scaled up and positioned on the screen simeltaneously (using a timeline)...as if they were attached or parented. My attempts to do this result in one of the images moving at a slightly different rate which is not what I need.

 

Below doesn't work as written ...but should give you an idea what I need to do:

var tl = new TimelineMax({paused:true, reversed:true});
TweenLite.defaultEase = Elastic.easeInOut;
tl.to(stage.ImageA (and ImageB), 1.3, {scaleX:3,scaleY:3, x: '+=263', y: '-=50'});
//These images need to scale up and move exactly in tandem as if attached.

Any help appreciated!

Link to comment
Share on other sites

  • Solution

Because of the way transforms work, the images themselves will have no affect on each other if transformed directly. Illustrated here,

 

See the Pen evyVjE by sgorneau (@sgorneau) on CodePen

 

So, to make them transform "together" is right on with your line of thinking; transforming the parent. Illustrated here,

 

See the Pen qrpxMy by sgorneau (@sgorneau) on CodePen

  • Like 4
Link to comment
Share on other sites

Thanks Shawn,

Exactly what I was asking for.

Link to comment
Share on other sites

...and sorry about misspelling your name.

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.
×