GreenSock also supports the ability to animate
from a variable point to the current point. If you think
to starts at a static point and moves to a variable point then
from essentially does the opposite.
fromTo supports the scenario where both points are variables and requires passing in a "from" set of properties and a "to" set of properties.
Instructor: [00:00] Set up an event listener on the document. Add event listener. When you click, we're going to grab the event and use TweenMax. We'll use from instead of to, but still target the element of box, say one second. We'll grab the X and Y off of the event -- so X and Y from the event -- so that the event XY gets passed in down here.
[00:28] When I hit save here and click, you'll see the box comes to the mouse and returns back to where it started. It's tweening from where I click, so click it tweens from where I click, click tweens from where I click.
[00:45] There's also fromTo which behaves very similarly. It allows you to pass in another set of options, where I'll say X500, Y500. Now it'll tween from where I click to 500 and 500. Click, and now it goes down there. Click, now it goes down there. Click, and down, and to the right.
[01:12] From returns to where it started and fromTo allows you to define that ending position here.