Рассматривали ли вы перевести #anim_test_top
?Далее, мой код, куда я перевожу #anim_test_top
.Также я внес некоторые изменения в ваш SVG, поскольку вы тоже можете трансформироваться.
svg{max-height:100vh;}
#anim_test_top {
stroke:cyan;
width: 450px;
height: 100px;
transform:translate(0, 0);
animation: anim 2s linear forwards;
}
text{font-family:'Source Sans Pro';font-weight:400;font-size:72px;font-style:normal;fill:#A4A598;stroke:none;}
@keyframes anim {
0% {
transform:translate(0, 0);
}
100% {
transform:translate(450px, 0);
}
}
<svg class="responsive-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 948 500">
<!-- This is the main background -->
<g>
<rect x="0" y="0" width="948" height="1114" fill="#eee" />
<g>
<text y="200" x="424" id="text" text-anchor="middle">INTERIOR</text></g>
</g>
<!-- First box cover-->
<rect id="anim_test_top" width="450" height="100" x="200" y="130" fill="rgba(255,255,255,.75)" >
</rect>
</svg>
Надеюсь, это поможет
ОБНОВЛЕНИЕ:
если перевод невозможен, вы можете масштабировать прямоугольник:
svg{max-height:100vh;}
#anim_test_top {
stroke:cyan;
width: 450px;
height: 100px;
transform-origin: top right;
transform:scale(1, 1);
animation: anim 2s linear forwards;
}
text{font-family:'Source Sans Pro';font-weight:400;font-size:72px;font-style:normal;fill:#A4A598;stroke:none;}
@keyframes anim {
0% {
transform:scale(1, 1);
}
100% {
transform:scale(0, 1);
}
}
<svg class="responsive-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 948 500">
<!-- This is the main background -->
<g>
<rect x="0" y="0" width="948" height="1114" fill="#eee" />
<g>
<text y="200" x="424" id="text" text-anchor="middle">INTERIOR</text></g>
</g>
<!-- First box cover-->
<rect id="anim_test_top" width="450" height="100" x="200" y="130" fill="rgba(255,255,255,.75)" >
</rect>
</svg>