GSAP is a powerful JavaScript library used to create high-performance animations, such as moving, rotating, or scaling elements on a web page.
Set up a basic HTML, CSS, and JavaScript structure.
Include the GSAP library by pasting its CDN link before your custom JavaScript file (script.js).
👉 Use this link:
https://cdnjs.com/libraries/gsap
Example HTML structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GSAP Animation</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="box"></div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"
integrity="sha512-7eHRwcbYkK4d9g/6tD/mhkf++eoTHwpNM9woBxtPUBWm67zeAfFC+HrdoE2GanKeocly/VxeLvIqwvCdk7qScg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script src="script.js"></script>
</body>
</html>
In your CSS file (styles.css), create a box with the following styles:
#box {
height: 200px;
width: 200px;
background-color: #3498db;
margin: 50px auto;
}