Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Presuming Ed

Newbie Question about Cycle Property

Recommended Posts

Hey

 

I'm getting to grips with using GSAP in Animate cc, and I've come across the  cycle property and am trying to cycle through an array, as follows:

 

var items = [this.item1,this.item2,this.item3]
var tl = new TimelineMax();

tl.staggerFrom(items, 2, {autoAlpha: 1,scaleX: 0,scaleY: 0, ease:Bounce.easeOut, cycle:[-100,100]}, delay:2}, 0.1)

 

but it seems to ignore the cycle request. I've noticed people use list items within HTML, so is this the reason it won't work?

 

(Sorry no codepen)

 

Thanks!

Link to comment
Share on other sites

I'm not sure which property you want to cycle, but you just have a little syntax problem. If you wanted to cycle the x position, you'd write it like this:

 

tl.staggerFrom(items, 2, {autoAlpha: 0,scaleX: 0,scaleY: 0, ease:Bounce.easeOut,  cycle:{x:[-100,100]} }, 0.1);

 

Hopefully that helps. Happy tweening.

:)

 

  • Like 2
Link to comment
Share on other sites

Thanks man thats works fine. I think i'm getting confused with this property though. What I'm trying to do is cycle so that some items fly in from the left and some from the right, alternately. Am I setting this up correctly?

 

Thanks in advance!

Link to comment
Share on other sites

Staggering left and right sounds like you'd want to cycle the x position. Here's a quick example.

 

See the Pen gveqRM by PointC (@PointC) on CodePen

Hopefully that helps. Happy tweening.

:)

 

  • Like 5
Link to comment
Share on other sites

2 hours ago, PointC said:

Staggering left and right sounds like you'd want to cycle the x position. Here's a quick example.

 

See the Pen gveqRM by PointC (@PointC) on CodePen

Hopefully that helps. Happy tweening.

:)

 

 

Got it! Thanks for your help. At first it was doing the same as before and then i realised it was all to do with the x values not being correct! Doh! I always tend to look for more complicated solutions and forget the obvious!!

Thanks again for your time

 

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