Answer the question
In order to leave comments, you need to log in
How to stretch a triangle while maintaining the fill proportions?
There is such a triangle with the background from the picture :
<svg version="1.1" width="800px" height="250px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 100 100" preserveAspectRatio="none" >
<pattern id="img_test" width="747" height="274" patternUnits="userSpaceOnUse">
<image height="100%" xlink:href="https://image.ibb.co/mtOsjo/test_1.png" x="-86" />
</pattern>
<polygon fill="url(#img_test)" points="0,100 50,0 100,100"/>
</svg>
Answer the question
In order to leave comments, you need to log in
<svg version="1.1" viewBox="0 0 200 200" xml:space="preserve" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<svg id="trian" viewBox="0 0 200 200" >
<pattern id="img_test" width="200" height="200" patternUnits="userSpaceOnUse">
<image x=-100 y=0 width="400" xlink:href="https://image.ibb.co/mtOsjo/test_1.png" />
</pattern>
<polygon fill="url(#img_test)" points="0,200 100,0 200,200"/>
</svg>
<rect id="улёт" x="5" y="180" width="40" height="20" fill="#c52" />
<rect id="влёт" x="45" y="180" width="40" height="20" fill="#5c2" />
<!--<use xlink:href="#trian" x="0" y="0" width="200" height="200"></use>-->
<animate xlink:href="#trian" attributeType="XML" attributeName="viewBox"
from="0 0 200 200" to="-500 -500 2000 2000" dur="0.8s"
begin="улёт.click" fill="freeze" />
<animate xlink:href="#trian" attributeType="XML" attributeName="viewBox"
from="-500 -500 2000 2000" to="0 0 200 200" dur="0.8s"
begin="влёт.click" fill="freeze" />
</svg>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question