We have already completed the modal animation with CSS, but I still want to show you how to use GSAP to animate the waving hand. This will help you learn to use GSAP in a real project.
Since we are going to create the waving hand animation with GSAP, you need to remove (or comment) the animation from the CSS.
We want the hand to have an animation when the modal opens. Here, we can create a wave function that tells the hand to wave. We only use wave when we open the modal.
If we don’t write any code, we know .wave-hand already has a scale of 1 and an opacity of 1. If we want to create the animation, we want to animate fromscale 0.25 and opacity 0.
We can create a from animation with the from method.
Note: The red squiggly underlines beneath TimelineMax and Back are because Standard (the linter) doesn’t recognize them as variables. See the linter lesson on how to remove these underlines.
When you use GSAP, you don’t care about the points (at 20%, at 40%, etc). You care about what happens between these points. You also care about the amount of time between the points.
From 0% to 20%, you want the hand to rotate to your right. Here, you use the to method. The duration of this movement is 0.2 seconds.