DEV Community

Cover image for Challenge: Get started with GSAP 3
Christina Gorton
Christina Gorton

Posted on

Challenge: Get started with GSAP 3

GreenSock updated it's API to version 3. If you would like to explore how to get started with GSAP 3 check out the mini-challenges and solutions below.

For reference while animating

GreenSock's Docs

Ease Visualizer

To get started with GreenSock, use the method

Use the CodePen below and follow the directions. Once you give it a try you can check out the solution I provided.

Good first objective. Try to animate these divs.

  1. Make one of the divs move left and right
  2. make on of the divs move up and down
  3. make one of the divs scale up or down
  4. make one of the dives fade in and out
  5. Try out GreenSock's stagger property to make all of the divs animate.

Solution examples:

Check out after you have tried the stagger yourself

Animating SVGs

✅ Here are basic SVG shapes. Use what you learned above to animate the SVGs. You can look for each SVGs ID in the HTML and animate them individually.

Solution example:

Timeline animations

In the pens below I challenge you to set up reusable functions that you can add to a single master timeline.

This helps clean up your code and allows you to add the same animations to several different elements.

Check out the documentation for Timelines and then check out the solution pen.

In it I break down how I use gsap.set, gsap.timeline, reusable functions and then how I combine them all in to a single master timeline.

✅ You can use this pen to either keep practicing animating SVG's with tweens or with timelines.

Check out this pen after you have tried to use reusable functions and a master timeline.

More Resources:

How to animate on the web with GreenSock

GSAP 3 features

Getting started examples:
Finding inspiration and Creating SVG

Have fun with GreenSock's Draggable and Hello Kitty

Great resource to explore writing TimeLines
Writing Smarter Animation Code

Extra courses:

Sarah Drasner: Frontend Masters: SVG essentials & Animation

My course: Intro to SVG and GreenSock Animations

Top comments (2)

lauragift21 profile image
Gift Egwuenu

Love it! I checked out GSAP a few days ago and I love it. I can't wait to try out these challenges.

coffeecraftcode profile image
Christina Gorton

I'd love to see it if you do try out the challenges 😀 Let me know if you have any questions.