I'm trying to make an animated border radius via using an SVG with border-image, and round it out with border-radius. I have overflow: hidden;
but the border doesn't seem to be affected by this property. I'll give the current code below, and an example of the border styles in a JSFiddle. Any help is appreciated!
margin: 0 auto;
height: 80vh;
font-size: 3vw;
overflow: hidden;
border: 5px solid;
border-image: url(../images/borderAnimation.svg) 5 stretch;
border-radius: 15px;
background-color: rgb(70, 70, 70);
JSFiddle: https://jsfiddle.net/madaley/vfunmsr7/
I know this is kind of cheating, but if you could have nested elements then the parent could have a background and the child could mask of the background with a color:
div.wrapper {
width: 300px;
height: 200px;
border-radius: 10px;
padding: 5px;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMDAgMjAwIj4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0ibGcxIj4KICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9Im9yYW5nZSIgLz4KICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9Im5hdnkiIC8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTUwIDEwMCkiPgo8Y2lyY2xlIHI9IjIwMCIgZmlsbD0idXJsKCNsZzEpIj4KPGFuaW1hdGVUcmFuc2Zvcm0KICAgICAgYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIgogICAgICBhdHRyaWJ1dGVUeXBlPSJYTUwiCiAgICAgIHR5cGU9InJvdGF0ZSIKICAgICAgZnJvbT0iMCIKICAgICAgdG89IjM2MCIKICAgICAgZHVyPSI1cyIKICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CjwvY2lyY2xlPgo8L2c+ICAgIAo8L3N2Zz4K');
background-repeat: no-repeat;
background-size: cover;
display: flex;
align-items: center;
justify-content: center;
}
div.wrapper>div {
width: 100%;
height: 100%;
border-radius: 5px;
box-sizing: border-box;
background: white;
}
<div class="wrapper">
<div></div>
</div>
The SVG for the background:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200">
<defs>
<linearGradient id="lg1">
<stop offset="0" stop-color="orange" />
<stop offset="1" stop-color="navy" />
</linearGradient>
</defs>
<g transform="translate(150 100)">
<circle r="200" fill="url(#lg1)">
<animateTransform attributeName="transform" attributeType="XML"
type="rotate" from="0" to="360" dur="5s" repeatCount="indefinite" />
</circle>
</g>
</svg>