Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                		<svg
			id="svg"
			width="1728"
			height="1047"
			viewBox="0 0 1728 1047"
			fill="none"
			xmlns="http://www.w3.org/2000/svg"
			preserveAspectRatio="none"
		>
			<g id="group" style="transform-origin: center">
				<path
					id="shape-1"
					d="M960.61 438.28C969.79 290.78 1078.27 195.28 1002.57 70.2802C947.99 -19.8298 675.29 -28.9298 637.54 101.68C588.45 271.53 720.81 344.03 774.1 414.28C816.97 470.79 756.29 461.77 722.8 445.59C689.31 429.41 311.66 165.83 168.19 211.43C-82.0099 290.96 -21.8499 623.41 174.86 630.94C475.68 642.47 810.22 548.65 795.52 567.27C742.71 634.18 494.11 617.67 259.19 745.27C110.54 826.01 226.35 1209.27 743.53 956.27C931.26 864.44 891.83 662.84 919.7 641.25C946.24 620.7 944.02 869.71 1116.83 979.4C1168.94 1012.48 1517.01 1121.27 1645.75 946.52C1893.34 610.43 1212 600.17 1071.87 584.26C849.29 558.98 1270.24 571.77 1515.79 510.88C1688.81 467.97 1869.97 204.49 1543.77 155.07C1087.49 85.9402 954.65 534.19 960.62 438.27L960.61 438.28Z"
					stroke="black"
					stroke-width="5"
					vector-effect="non-scaling-stroke"
				/>

				<path
					id="shape-2"
					d="M960.789 438.28C969.969 290.78 1078.48 195.28 1002.76 70.2802C948.17 -19.8298 675.409 -28.9298 637.659 101.68C588.559 271.53 720.94 344.03 774.24 414.28C817.12 470.79 582.5 316.46 549.01 300.28C515.52 284.1 311.71 165.83 168.22 211.43C-82.0305 290.96 -21.8505 623.41 174.89 630.94C475.76 642.47 810.359 548.65 795.659 567.27C742.839 634.18 326.97 595.67 91.9995 723.27C-56.6805 804.01 -27.2805 1201.27 490 948.27C677.76 856.44 858.12 615.86 886 594.27C912.54 573.72 800.1 828.53 925 927.27C1159 1112.27 1593 1053.27 1610 908.27C1648.04 583.8 1212.22 600.17 1072.06 584.26C849.44 558.98 1213.4 584.16 1459 523.27C1632.06 480.36 1519 326.27 1376 330.27C1134.59 337.02 954.809 534.19 960.789 438.27V438.28Z"
					stroke="black"
					stroke-width="5"
					vector-effect="non-scaling-stroke"
				/>
			</g>
		</svg>
              
            
!

CSS

              
                * {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100svh;
}

svg {
	width: 100%;
	height: 100%;
}

#shape-2 {
	visibility: hidden;
}

              
            
!

JS

              
                let mouseX = 0;
let mouseY = 0;
const screenWidth = window.innerWidth;
const screenHeight = window.innerHeight;

const tl = gsap.timeline({ paused: true });
tl.to("#shape-1", { morphSVG: "#shape-2", duration: 1 });

const tlRotate = gsap.timeline({ paused: true });
tlRotate.to("#group", { rotation: 180, duration: 1 });

const clamp = (value, min, max) => Math.min(Math.max(value, min), max);

document.addEventListener("mousemove", (event) => {
	mouseX = event.clientX;
	mouseY = event.clientY;
	const progress = clamp(mouseX / screenWidth, 0, 1);
	const progressRotation = clamp(mouseY / screenHeight, 0, 1);
	tl.progress(progress);
	tlRotate.progress(progressRotation);
});
              
            
!
999px

Console