Jump to content
Search Community

How convert this GSAP 2 to GSAP 3

teste_brazil_1998 test
Moderator Tag

Recommended Posts

const tl = gsap.timeline()

tl.to(['.sun', '.moonMask', '.moon'], {
  attr: gsap.utils.wrap([{cx:'-=140', cy:'-=20'}, {cx:'-=140', cy:'-=20'}, {cx:'-=90',  cy:'-=0'}]),
  duration: 1, 
  stagger: yourStaggerAmount // yours is currently none, so you could remove this line
}

Check out GSAP's wrap utility to compare to the old cycle: https://greensock.com/docs/v3/GSAP/UtilityMethods/wrap()


I haven't had my coffee yet, so let me know if this has issues

 

Link to comment
Share on other sites

5 minutes ago, elegantseagulls said:
const tl = gsap.timeline()

tl.to(['.sun', '.moonMask', '.moon'], {
  attr: gsap.utils.wrap([{cx:'-=140', cy:'-=20'}, {cx:'-=140', cy:'-=20'}, {cx:'-=90',  cy:'-=0'}]),
  duration: 1, 
  stagger: yourStaggerAmount // yours is currently none, so you could remove this line
}

Check out GSAP's wrap utility to compare to the old cycle: https://greensock.com/docs/v3/GSAP/UtilityMethods/wrap()


I haven't had my coffee yet, so let me know if this has issues

 

Typescript show this error 

 

Type '(index: number) => { cx: string; cy: string; }' is not assignable to type 'AttrVars'.
  Index signature for type 'string' is missing in type '(index: number) => { cx: string; cy: string; }'.

Link to comment
Share on other sites

1 hour ago, elegantseagulls said:

@chrisgannon has a lot of complexities going on in his button. I'd recommend starting simple with your own design and working up from there than just trying to pull a larger complex animation into your site all at once.

How would this one look?

 

tl.staggerFromTo(allClouds, 0.6, {
 cycle:{
  y:[120, 160],
  x:[0]
 }
},
{ cycle:{
  y:[0],
 x:[0]
 },
 alpha:1,
 immediateRender:false
},0.06,'-=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...