GSAP - Animate SVG path with AttrPlugin

Developer
Size
2,074 Kb
Views
8,096

How do I make an gsap - animate svg path with attrplugin?

Regarding this post from the GSAP forums: http://greensock.com/forums/topic/15603-getting-control-points-of-a-wave-svg-and-use-it/. What is a gsap - animate svg path with attrplugin? How do you make a gsap - animate svg path with attrplugin? This script and codes were developed by Pedro Tavares on 01 December 2022, Thursday.

GSAP - Animate SVG path with AttrPlugin Previews

GSAP - Animate SVG path with AttrPlugin - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>GSAP - Animate SVG path with AttrPlugin</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg xmlns="http://www.w3.org/2000/svg" width="1440" height="240" viewBox="0 0 1440 240"> <path d="M0 120 Q360 60 720 120 T 1440 120 V240 H0 Z"></path>
</svg> <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

GSAP - Animate SVG path with AttrPlugin - Script Codes CSS Codes

svg {
/* border: 1px solid black; */ display: block; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); stroke: black; stroke-width: 2; fill: black; width: 90%;
}

GSAP - Animate SVG path with AttrPlugin - Script Codes JS Codes

// The first line below is the path in the SVG, the one underneath it is the one being used in the tween, only one number has been changed.
// "M0 120 Q360 60 720 120 T 1440 120 V240 H0 Z"
// "M0 120 Q360 180 720 120 T 1440 120 V240 H0 Z"
TweenMax.to("path", 2, { attr:{ d:"M0 120 Q360 180 720 120 T 1440 120 V240 H0 Z" }, ease: Power1.easeInOut, repeat:-1, yoyo:true
})
GSAP - Animate SVG path with AttrPlugin - Script Codes
GSAP - Animate SVG path with AttrPlugin - Script Codes
Home Page Home
Developer Pedro Tavares
Username dipscom
Uploaded December 01, 2022
Rating 3
Size 2,074 Kb
Views 8,096
Do you need developer help for GSAP - Animate SVG path with AttrPlugin?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Pedro Tavares (dipscom) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!