<div class="box">
<svg viewBox="0 0 236 200">
<g class="path" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="1">
<path d="M0,0 C40,240 200,240 240,0" fill="none" stroke="#ffffff" stroke-dasharray="5 3"/>
</g>
</svg>
<div class="offset-path"></div>
</div>
<aside>
<label for="offset">offset-distance: </label><output id="offset-output">0%</output>
<input id="offset-input" type="range" value="0" min="0" max="100"/>
</aside>
@import url('https://fonts.googleapis.com/css?family=Gochi+Hand');
* {
box-sizing: border-box;
}
:root {
--offset: 0%;
}
body {
margin: 0;
padding: 0;
background-color: #291642;
font-family: 'Gochi Hand', sans-serif;
color: #fff;
font-size: 130%;
letter-spacing: 0.1rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100vw;
min-height: 100vh;
}
.box {
width: 240px;
height: 240px;
border: 1px dashed #f36;
margin-bottom: 2vh;
position: relative;
}
.offset-path {
width: 5vh;
height: 5vh;
border: 1px solid hsla(343,100%,58%,.3);
border-right: 5px solid hsl(343,100%,58%);
background: hsla(343,100%,58%,.3);
position: absolute;
offset-path: path('M0,0 C40,240 200,240 240,0');
offset-distance: var(--offset);
}
svg {
position: absolute;
opacity: .3;
}
View Compiled
const offsetInput = document.querySelector('#offset-input');
const offsetOutput = document.querySelector('#offset-output');
offsetInput.addEventListener('input', function(e) {
let offset = `${e.currentTarget.value}%`;
offsetOutput.textContent = offset;
document.documentElement.style.setProperty('--offset', offset);
});
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.