Jump to content
Search Community

Simplify a lot of similar movement...

barrowman test
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

.to(root.Bokeh5, 3.70, {x:-300, ease:Sine.easeInOut, overwrite: false}, "one+=0.9")
.to(root.Bokeh4, 4.80, {x:-270, ease:Sine.easeInOut, overwrite: false}, "one+=0.7")
.to(root.Bokeh3, 6.70, {x:-290, ease:Sine.easeInOut, overwrite: false}, "one+=0.8")
.to(root.Bokeh2, 5.50, {x:-330, ease:Sine.easeInOut, overwrite: false}, "one+=0.9")
.to(root.Bokeh1, 5.20, {x:-290, ease:Sine.easeInOut, overwrite: false}, "one+=0.5")

 

This is some of my code in Animate.

 

I'm not sure whether there is a better way to do this, where I have five MCs that I want to pan across a screen at more or less the same time and speed, but not exactly. I know I could have done a Stagger but then the movement and times would have been identical and movement uniform.

 

Is it possible to do a stagger type thing that's a little less uniform?

 

Thanks in advance. 

Link to comment
Share on other sites

5 ain’t that many :)

 

Your code isn’t really decrementing or incrementing in a predictable fashion. I mean you could change defaultEase and defaultOverwrite so you don’t have to write that again OR you can use a variable for that. 

 

You could use an array for the values and then a loop but that’s total overkill and a loop is going to be slower than just doing the 5 lines. I think what you’re doing is just fine TBH.

 

You could also go random but looks like these are precise values you’re animating visually, not totally random.

  • Like 3
  • Thanks 1
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.
×
×
  • Create New...