My SVG includes a clipPath
with a rectangle inside it, which I want to transform into a fixed shape. However, when I try to change the height of the rectangle, it remains fixed at the top of the clipPath
or SVG. I actually want it to stay at the bottom and have the ability to change the height from bottom to top.
Here is the snippet of the SVG code:
<svg version="1.1" id="logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 505 162.7" style="enable-background:new 0 0 505 162.7;" xml:space="preserve" class="go">
<style type="text/css">
.D{clip-path:url(#Dobrys_1_);}
.fill3 {
fill:#4E7DBF;
}
</style>
<g id="D">
<defs>
<path id="Dobrys" d="M75,111.9c-8.5,8.8-19,13.2-31.2,13.2c-12,0-22.4-4.3-30.9-12.8C4.3,103.7,0,93.4,0,81.3
c0-12.1,4.3-22.4,12.9-30.9c8.6-8.6,18.9-12.8,31-12.8c12.3,0,22.7,4.4,31.3,13.2V6.3c0-4.2,2.1-6.3,6.2-6.3
c4.2,0,6.2,2.1,6.2,6.3v112.5c0,4.2-2.1,6.3-6.3,6.3c-3.2,0-5.2-1.5-5.9-4.6C75.1,119.2,75,116.4,75,111.9z M75.1,81.3
c0-8.6-3.1-15.9-9.2-22.1C59.8,53.1,52.4,50,43.8,50c-8.6,0-16,3.1-22.1,9.2c-6.1,6.1-9.2,13.5-9.2,22.1c0,8.6,3.1,16,9.2,22.1
c6.1,6.1,13.5,9.2,22.1,9.2c8.6,0,16-3.1,22.1-9.2C72,97.3,75.1,89.9,75.1,81.3z">
</path>
</defs>
<clipPath id="Dobrys_1_">
<use xlink:href="#Dobrys" style="overflow:visible;"></use>
</clipPath>
<rect id="D3" x="0" y="0" class="D fill3" width="90.7" data-height="125.3"></rect>
</g>
</svg>
I've been trying to animate the height in a CodePen example, which you can view here:
CodePen Link
Please refrain from suggesting the use of linearGradient, as I have multiple rectangles in the design. Also, using transform: scale
won't achieve the desired effect as it will 'shrink' rather than 'cut'. Can anyone provide guidance on this issue?