Jump to content
GreenSock

phillip_vale

Greensock Background change

Recommended Posts

Hi,

I'm trying to get a background image .gif to change from one image to the another.

I want the animation to change from Homer to Leo and repeat endlessly.

 

I'm just after a straight cut in the transition so i thought .set would do it rather than a .to or .from with opacity etc.

 

Thanks for the help,

Phil

See the Pen jOzMNry by phillipanthonyvale (@phillipanthonyvale) on CodePen

Link to comment
Share on other sites

Hey there,

 

You'll get a straight cut anyway with a to tween as you can't animate between different background images - there's no 'in between' state. It's either one image or the other.

But whether you're using set or to you're going to need to add some position parameters and maybe a repeatDelay so that your tweens are spaced out. Right now they're both happening at the same time (set is 0 duration)

See the Pen XWEjXMj?editors=1111 by GreenSock (@GreenSock) on CodePen



I've also updated your timeline to use the latest syntax and not timelineMax (that's version 2)

 

Hope this helps!
 

Link to comment
Share on other sites

Amazing, thanks so much Cassie!

 

Just a quick question. What happens to the gifs when they aren't showing are they still playing in the background?

 

OR does the .set function sort of turn them off?

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