
Quick Lecture Overview
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
📘 So far, you learned:
But sometimes you don’t want GSAP to guess.
You want to say:
That’s where comes in.
lets you define both the starting and ending values manually.
This is super useful when:
gsap.fromTo(
".box",
{
opacity: 0, // Start invisible
y: 100, // Start 100px lower
},
{
opacity: 1, // End fully visible
y: 0, // End at normal position
duration: 1,
}
);
✅ The box fades in while moving from 100px below back to its normal position.
The box starts invisible and shifted down.
It animates to fully visible and back to normal position.
Clean. Predictable. Controlled.
gsap.fromTo(targets, fromVars, toVars);
✅ Tip:
fromVars
duration
, ease
, delay
) inside toVars
👉 Animate a .box to scale up and fade in using :
gsap.fromTo(
".box",
{ opacity: 0, scale: 0 }, // Start tiny and invisible
{ opacity: 1, scale: 1, duration: 1 } // Grow and appear
);
You’ve now learned the three core tween types: , , and .
You're ready for the next big skill:
✨ Stagger animations — animate multiple elements with beautiful delays between them!
Let’s animate armies of elements together in the next lesson! 🚀
By logging in, you'll unlock full access to this and other free tutorials on JSM Pro.
Why? Logging in lets us personalize your learning experience, track your progress, and keep you in the loop with new workshops, coding tips, and platform updates.
You'll also be the first to know about upcoming launches, events, and exclusive discounts.
No spam—just helpful content to level up your skills.
If that sounds fair, go ahead and log in to continue →
Enter your name and email to get instant access
##Looks like we found a thief monkey By the way, I liked the trick how you reached till here. You have a good sense of humor. You will improve a lot if you join our course with this passion.
var
(function-scoped, outdated)let
(block-scoped, modern and recommended)const
(block-scoped, cannot be reassigned)_
, or $
let let = 5;
is invalid)myVar
and myvar
are different)string
, number
, boolean
, null
, undefined
, bigint
, symbol
Objects
, Arrays
, Functions
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
00:00:00 You've learned about GSAP2 and GSAPFrom methods, but now imagine if you could combine them into one.
00:00:06 It's GSAPFrom2, used to animate elements from a new state to another new state.
00:00:13 I'll show you how it works on this wave loading animation using plain GSAP.
00:00:18 So head over into GSAPFrom2.
00:00:22 Take a look at the index HTML just to see what we're working with.
00:00:26 And you'll see that this wave loader is nothing more than a div, which contains multiple bars.
00:00:33 Each one of these is just a div with some border radius and a gradient.
00:00:38 We can also check those out within the styles where it's a simple div and then bars, which have some, as I told you, border radius,
00:00:46 height, width, and then a background.
00:00:48 So how do we go about creating this crazy wave effect?
00:00:53 Looks pretty complex, right?
00:00:55 Well, let me show you.
00:00:57 First, we want to import GSAP from GSAP, and then we want to select all elements with a class of .bar in a specific list.
00:01:07 So say const bars is equal to document.querySelectorAll and then we want to get all that have a class name of .bar.
00:01:19 Then we want to say bars.forEach, so we're looping through them, and then for each one of these bars, we'll also get their index,
00:01:28 and we want to run the gsap.fromTo method.
00:01:33 The fromTo works like this.
00:01:35 You first pass the target, you then pass the from bars, and then you pass the to bars.
00:01:41 So it looks something like this, target, and then position, and then position.
00:01:47 Let's try it out.
00:01:48 In this case, we want to target a specific bar.
00:01:52 Then you can define the from variables.
00:01:54 Let's say that you want to animate them from, well, let's do scale Y.
00:02:00 So that's their Y position of something like 0.4. And then as the third parameter, you can provide where you want to animate them to.
00:02:08 So I'll say scale Y.
00:02:11 up to 1.6 of their size.
00:02:13 So now we can see they expand.
00:02:15 Basically, think of this as a combined from and to.
00:02:19 This object corresponds to gsub.from method, and this one corresponds to the gsub.to method.
00:02:25 But now they're both here together.
00:02:26 Let's say we want to do it throughout iteration of 0.6 seconds, and with an ease of sine.inout, we can also add a repeat of minus one,
00:02:38 so it repeats indefinitely, And I think now you can kind of see where the from and to is coming from.
00:02:44 We're basically just changing the scale of these properties, but this is looking super unnatural, so I'll add the yo-yo to true.
00:02:52 This will already make a big difference because now when it comes to the end, it actually comes back and then it repeats.
00:02:58 But now the only thing that'll make a difference is adding a delay to each one of these elements.
00:03:04 a delay of the index times 0.1 seconds.
00:03:09 Why index?
00:03:10 Because it starts from zero, moves over to 1, 2, 3, 4, 5, 6, 7. And now if we save it, each one will get a different delay and we'll get this beautiful,
00:03:20 very simple HTML CSS animation right within your browser.
00:03:26 Done only using plain CSS.
00:03:29 No SVGs, no images, nothing else.
00:03:32 Congrats.
00:03:33 Now we know how to use a very powerful GSAP from2 method.