Coaster SVG

Developer
Size
2,133 Kb
Views
36,432

How do I make an coaster svg?

Use getPointAtLength() to find a point along a path.. What is a coaster svg? How do you make a coaster svg? This script and codes were developed by Elliot Geno on 11 September 2022, Sunday.

Coaster SVG Previews

Coaster SVG - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Coaster SVG</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg version="1.1" id="roller-coaster" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 600" enable-background="new 0 0 1000 600" xml:space="preserve"> <path id="track" fill="none" stroke="white" stroke-linecap="round"stroke-width="5" d="M50,372C165,372,173,176,262,176s82,234,184,234	c72,0,80-110,168-110.9c68,0,84,128,168,128c73,0,83-38,158-38" /> <circle fill="white" id="coaster" cx="50" cy="372" r="14" />
</svg> <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Coaster SVG - Script Codes CSS Codes

body{ overflow:hidden; background:#0076ff;
}
#roller-coaster{ width:100%; height:100%; position:absolute;
}

Coaster SVG - Script Codes JS Codes

var track = document.getElementById("track");
var coaster = document.getElementById("coaster");
var progress = { percentage: 0
};
TweenMax.to(progress, 3, { repeatDelay: 2, percentage: 1, repeat: -1, ease: Quint.easeInOut, onUpdate: update
});
function update() { var trackLength = track.getTotalLength(); var point = track.getPointAtLength(progress.percentage * trackLength); coaster.setAttribute("cx", point.x); coaster.setAttribute("cy", point.y);
}
Coaster SVG - Script Codes
Coaster SVG - Script Codes
Home Page Home
Developer Elliot Geno
Username pyrografix
Uploaded September 11, 2022
Rating 3
Size 2,133 Kb
Views 36,432
Do you need developer help for Coaster SVG?

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!

Elliot Geno (pyrografix) Script Codes
Create amazing Facebook ads 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!