Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 1.15 KB

09-stop-animations-with-killtweensof-and-killall-in-greensock.md

File metadata and controls

27 lines (22 loc) · 1.15 KB

Stop Animations with killTweensOf and killAll in Greensock

📹 Video

Stop animations by clicking on target

  1. Use the random boxes from previous video but place the animation outside of the eventListener and set them to animate to a fixed point.
TweenMax.to(divs, 10 { x: 100, y: 100})
  1. Inside the click even function use 🤔TweenMax.killTweensof() and use event.target to select the box clicked on.
TweenMax.killTweensOf(event.target)

Stop all animations

  1. Use 🤔TweenMax.killAll() instead to stop all animations.
TweenMax.killAll()
  1. Optionally you can pass an argument of true into killAll() to cause all animations to complete.
TweenMax.killAll(true)

📹 Go to Previous Lesson 📹 Go to Next Lesson