<!DOCTYPE html>
<html>
<head>
<style>
#frameDiv {
width: 200px;
height: 200px;
margin: 20px;
position: relative;
border: solid black 1px;
background-color: rgb(205, 242, 205);
}
#pinkDiv {
width: 30px;
height: 10px;
border-radius: 3px 10px 10px 3px;
background-color: hotpink;
offset-path: path('M 75,100 C 75,150 150,150 150,100 M 150,100 C 150,50 75,50 75,100');
animation: moveDiv linear 3s infinite;
}
@keyframes moveDiv {
100% { offset-distance: 100%; }
}
</style>
</head>
<body>
<h1>Change the offset-path property value with JavaScript</h1>
<p>The pink div is animated to follow a path written in SVG syntax.</p>
<p>Click the "Try it" button to change the path:</p>
<button onclick="myFunction()">Try it</button>
<div id="frameDiv">
<div id="pinkDiv"></div>
</div>