<svg id="tutorial" data-name="tutorial" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144.48 144.48">
<path class="shape" id="shape" d="M242.93,123A71.74,71.74,0,1,1,171.2,51.22,71.73,71.73,0,0,1,242.93,123Z" transform="translate(-98.96 -50.72)"/>
<text font-family="arial" font-size="14" fill="black">
<textPath xlink:href="#shape" startOffset="500px" id="textPath">Scroll to move a text on the circle.</textPath>
</text>
</svg>
body {
height: 200vh;
}
.shape {
fill:none;
stroke:#1d1d1b;
}
#tutorial {
position: fixed;
overflow: visible;
width: 15%;
left: 40%;
top: 100px;
transform: rotate(-150deg);
}
const textPath = document.querySelector("#textPath");
const a = document.documentElement,
b = document.body,
st = 'scrollTop',
sh = 'scrollHeight';
document.addEventListener("scroll", event => {
let percent = (a[st]||b[st]) / ((a[sh]||b[sh]) - a.clientHeight) * 100;
textPath.setAttribute("startOffset", (-percent * 5) + 500)
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.