Jump to content
Search Community

Brian Waters

Members
  • Posts

    3
  • Joined

  • Last visited

Brian Waters's Achievements

  1. Appreciate this helper function, @GreenSock - will be adding it to the toolkit! It provides exactly what we are looking for.
  2. @SteveS Thanks for the suggestion - agree that our usage here isn't typical, but alongside other surrounding GSAP animation code, it would offer brevity and consistency. @GreenSock This looks like the way to go, thank you!
  3. Hello, We're using stagger as a convenient way to control the timing of adding classes to DOM elements, in conjunction with other GSAP animation sequences. We'd like to be able to access the index of the current staggered item in callbacks. In trying both object and function versions, index doesn't seem to be readily available to callbacks - is there a property or utility method we're overlooking? Below are 3 approaches that we've tried exploring. Note we're not actually tweening properties here, just hoping to leverage stagger's ability to distribute over time. Is that possible without writing a custom loop? gsap.to(".productmenu-item", { stagger: { each: 0.1, onStart() { // Is there a way to access here the index value of the currently processing item? // this.targets()[0] returns the current targeted element but not its index in GSAP's array } }, }); gsap.to(".productmenu-item", { stagger: { each: 0.1, onStart: onMenuItemAnimationStart, onStartParams: [] // Can the current stagger index be passed as a parameter here? } }); gsap.to(".productmenu-item", { stagger: function (index, target, list) { // The index is accessible here but would like to pass it to callbacks such as onStart and onComplete per element return index * 0.1; } }); Thanks!
×
×
  • Create New...