-
Notifications
You must be signed in to change notification settings - Fork 497
Expand file tree
/
Copy pathGsapTo.jsx
More file actions
52 lines (46 loc) · 1.36 KB
/
GsapTo.jsx
File metadata and controls
52 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { useGSAP } from "@gsap/react";
import gsap from "gsap";
const GsapTo = () => {
// TODO: Implement the gsap.to() method
useGSAP(() => {
gsap.to("#blue-box", {
x: 350,
repeat: -1,
yoyo: true,
rotation: 180,
duration: 2,
ease: "elastic",
});
}, []);
return (
<main>
<h1>GsapTo</h1>
<p className="mt-5 text-gray-500">
The <code>gsap.to()</code> method is used to animate elements from their
current state to a new state.
</p>
<p className="mt-5 text-gray-500">
The <code>gsap.to()</code> method is similar to the{" "}
<code>gsap.from()</code> method, but the difference is that the{" "}
<code>gsap.to()</code> method animates elements from their current state
to a new state, while the <code>gsap.from()</code> method animates
elements from a new state to their current state.
</p>
<p className="mt-5 text-gray-500">
Read more about the{" "}
<a
href="https://greensock.com/docs/v3/GSAP/gsap.to()"
target="_blank"
rel="noreferrer noopener nofollow"
>
gsap.to()
</a>{" "}
method.
</p>
<div className="mt-20">
<div id="blue-box" className="w-20 h-20 bg-blue-500 rounded-lg" />
</div>
</main>
);
};
export default GsapTo;