SVG animation is not applied properly when a shape is moved - animation
I'm trying to apply SVG animation to a triangle which is moved by (100, 100) pixels:
<svg width="800" height="600">
<polyline shapeId="triangle" fill="transparent" stroke="gray" points="0,0 52.5,160 105,0 0,0 " transform=" translate(100 100)">
</polyline>
</svg>
I was expecting the triangle to be rotating around point (100, 100). However, the triangle is rotating around the origin of the SVG document:
<svg width="800" height="600">
<polyline shapeId="triangle" fill="transparent" stroke="gray" points="0,0 52.5,160 105,0 0,0 " transform=" translate(100 100)">
<animateTransform attributeName="transform" type="rotate" begin="0s" dur="5s" repeatCount="indefinite" from="0" to="360"/>
</polyline>
</svg>
If I specify rotation offset in the animation tag, the results are still not what I would expect: the triangle does not rotate around one of its corners.
<svg width="800" height="600">
<polyline shapeId="triangle" fill="transparent" stroke="gray" points="0,0 52.5,160 105,0 0,0 " transform=" translate(100 100)">
<animateTransform attributeName="transform" type="rotate" begin="0s" dur="5s" repeatCount="indefinite" from="0 100 100" to="360 100 100"/>
</polyline>
</svg>
What I want to achieve is triangle rotating around one of its cornered while moved by (100, 100) pixels.
How can I achieve this? Thank you.
You could always transform a parent element...
<svg width="800" height="600">
<g transform="translate(100 100)">
<polyline shapeId="triangle" fill="transparent" stroke="gray" points="0,0 52.5,160 105,0 0,0 " >
<animateTransform attributeName="transform" type="rotate" begin="0s" dur="5s" repeatCount="indefinite" from="0" to="360"/>
</polyline>
</g>
</svg>
Related
How to reverse animate motion?
Why my animation doesn't start from the top to the bottom ? How to reverse it correctly ? I don't know what I should change. (I tried keyPoints="1;0" keyTimes="0;1" which didn't work) <svg xmlns="http://www.w3.org/2000/svg" width="500" height="350" viewBox="0 0 500 350"><path d="M404.88 470.22V79.69c-.2-19-14.21-33-17.52-36.19s-16.77-15.19-34.7-15.45h-1.11c-28.65.35-59.55-.12-319.52 0H28" stroke="#000" stroke-miterlimit="10" fill="none" id="motionPath"></path><rect id="circle" x="-25" y="-25" rx="15" ry="15" width="50" height="50"></rect><animateMotion xlink:href="#circle" from="50" to="450" dur="5s" begin="0s" repeatCount="1" rotate="auto" fill="freeze"><mpath xlink:href="#motionPath"></mpath></animateMotion></svg>
It is necessary to remove from =" 50 " to =" 450 " since the length of the path of movement is determined by the length of the path mpath The direction of movement of an object along a path depends on two parameters keyPoints="1;0" - movement from start to finish keyTimes="0;1" keyPoints="0;1" - movement from end to start keyTimes="0;1" In the example below, JS is used only to handle the event of pressing the control buttons: forward and back var animation1 = document.getElementById("forward") function forwardSVG(){ animation1.beginElement(); } var animation2 = document.getElementById("back") function backSVG(){ animation2.beginElement(); } <div id="pathContainer4"> <button id="btn1" onclick="forwardSVG()">forward</button /> <button id="btn2" onclick="backSVG()">Back</button /> </div> <svg xmlns="http://www.w3.org/2000/svg" width="500" height="350" viewBox="50 0 500 350"> <path id="motionPath" d="M404.88 470.22V79.69c-.2-19-14.21-33-17.52-36.19s-16.77-15.19-34.7-15.45h-1.11c-28.65.35-59.55-.12-319.52 0H28" stroke="#000" stroke-miterlimit="10" fill="none" > </path> <rect id="circle" x="0" y="-25" rx="15" ry="15" width="50" height="50"></rect> <!-- Forward motion animation --> <animateMotion id="forward" xlink:href="#circle" dur="5s" begin="indefinite" rotate="auto" fill="freeze" repeatCount="1" keyPoints="1;0" keyTimes="0;1" calcMode="linear"> <mpath xlink:href="#motionPath"></mpath> </animateMotion> <!-- Backward motion animation --> <animateMotion id="back" xlink:href="#circle" dur="5s" begin="indefinite" rotate="auto" fill="freeze" repeatCount="1" keyPoints="0;1" keyTimes="0;1" calcMode="linear"> <mpath xlink:href="#motionPath"></mpath> </animateMotion> </svg>
Here is the reverse you want. I modified the shape a little but you can modify it back again. Hope that this is the solution to your problem. you can make it freeze too if you want. <svg xmlns="http://www.w3.org/2000/svg" width="500" height="350" viewBox="0 0 500 350"> <g> <path stroke="#000" stroke-miterlimit="10" fill="none" id="motionPath" d="M404.88 470.22V79.69c-.2-19-14.21-33-17.52-36.19s-16.77-15.19-34.7-15.45h-1.11c-28.65.35-59.55-.12-319.52 0H28"/> <rect id="circle" x="-25" y="-25" rx="15" ry="15" width="50" height="60" fill="black" stroke="black" stroke-width="1" transform="translate(-25,-10)"> <animateMotion path="M404.88 470.22V79.69c-.2-19-14.21-33-17.52-36.19s-16.77-15.19-34.7-15.45h-1.11c-28.65.35-59.55-.12-319.52 0H28" begin= "0s" dur="5s" repeatCount="1" rotate="auto" fill="freeze" keyPoints="1;0" keyTimes="0;1" calcMode="linear"/> </rect> </g> </svg>
How to make an object rotate around the exact center of the screen using animateTransform?
Consider the following SVG code for moving a circle around the center of the screen, with hard-coded dimensions: <svg xmlns="http://www.w3.org/2000/svg"> <g> <ellipse id="circ" style="fill:#000000" cx="60%" cy="50%" rx="10" ry="10" /> <!--Assuming window size is 1000x1000--> <animateTransform attributeName="transform" type="rotate" dur="10s" from="0,500,500" to="360,500,500" repeatCount="indefinite"/> </g> </svg> If I try to provide the center of rotation in percent, the animation doesn't work at all: <animateTransform attributeName="transform" type="rotate" dur="10s" from="0,50%,50%" to="360,50%,50%" repeatCount="indefinite"/> How do I fix this?
Set a viewBox on your SVG, then whatever size you make it, the ellipse will rotate around the centre of it. viewBox="0 0 1000 1000" The value of 1000 for width and height here is chosen because it would make 500 be the centre. svg:nth-child(1) { width: 200px; } svg:nth-child(2) { width: 500px; } svg { border: solid 1px green; } <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"> <g> <ellipse id="circ" style="fill:#000000" cx="60%" cy="50%" rx="10" ry="10" /> <!--Assuming window size is 1000x1000--> <animateTransform attributeName="transform" type="rotate" dur="10s" from="0,500,500" to="360,500,500" repeatCount="indefinite"/> </g> </svg> <!-- An exact duplicate of th first one --> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"> <g> <ellipse id="circ" style="fill:#000000" cx="60%" cy="50%" rx="10" ry="10" /> <!--Assuming window size is 1000x1000--> <animateTransform attributeName="transform" type="rotate" dur="10s" from="0,500,500" to="360,500,500" repeatCount="indefinite"/> </g> </svg>
How to animate the svg rectangle to grow like music wave?
I have a below code, <div id="akbar"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="400" height="200" viewBox="0 0 400 200"> <g transform="scale(1,-1) translate(0,-200)"> <rect x="50" y="0" fill="#f00" width="100" height="100"> <animate attributeName="height" from="0" to="100" dur="0.5s" fill="freeze" /> </rect> <rect x="150" y="0" fill="#f70" width="100" height="200"> <animate attributeName="height" from="0" to="200" dur="0.5s" fill="freeze" /> </rect> <rect x="250" y="0" fill="#ec0" width="100" height="150"> <animate attributeName="height" from="0" to="150" dur="0.5s" fill="freeze" /> </rect> </g> </svg> </div> I would like to animate the svg rectangle to grow like music waves. How can I achieve that? I need this behavior
You can achieve it using values, keyTimes and keySplines attributes of an <animate> tag. JSfiddle example. I stripped your example to single column only: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="400" height="200" viewBox="0 0 400 200"> <g transform="scale(1,-1) translate(0,-200)"> <rect x="50" y="0" fill="#f00" width="100" height="100"> <animate attributeName="height" from="0" to="100" dur="1s" fill="freeze" values="0; 200; 150; 160; 150; 160" keyTimes="0; 0.2; 0.4; 0.6; 0.8; 1" keySplines=".42 0 1 1; 0 0 .59 1; .42 0 1 1; 0 0 .59 1; .42 0 1 1; 0 0 .59 1;" /> </rect> </g> </svg> As it is not perfect yet, you can play around with the attributes to adjust the timing better (keySplines especially) and make it more music waves like. As you can see on the provided example, single column steps of movements are: All the way from bottom to top Then, from top to ~83% of height Then, from ~83% to ~88%, Then, from ~88% to ~83%, Then, from ~83% to ~88% I guess that increasing the difference between those repeating percentage numbers (83 and 88) will give you slightly better effect than mine (which is based on 75% and 80%, easier to calculate on widht: 200px), but it is close. Also take a look at CSS tricks article on SVG animation, it is very thorough and covers all the details about mentioned attributes - and much more.
SVG image tag zoom in and out animation
I have my SVG file with various animations written by me, i can't able to zoom image in image tag(I need it as an animation). In SVG circle tag works perfect for zoom in and zoom out animation. please anyone help me by giving your solution in pure SVG. <image id="img_id" x="200" y="200" width="50" height="50" preserveAspectRatio="none" xlink:href="my svg image as vector code"/> <animateTransform xlink:href="#img_id" begin="1s" values="-150,-150; 0,0" dur="0.5s" type="translate" attributeName="transform" fill="freeze" additive="sum"/> <animateTransform xlink:href="#img_id" begin="1s" values="2; 1" dur="0.5s" type="scale" attributeName="transform" fill="freeze" additive="sum"/> My SVG code in JSfiddle!
Adjust the translate animation for the image till it zooms from its centre. I.e. <svg version="1.1" width="512" height="512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <circle id="trigger" class="button" cx="150" cy="150" r="25" /> <animateTransform begin="1s" values="-150,-150; 0,0" dur="0.5s" type="translate" attributeName="transform" fill="freeze" additive="sum"/> <animateTransform begin="1s" values="2; 1" dur="0.5s" type="scale" attributeName="transform" fill="freeze" additive="sum"/> </g> <image id="img_id" x="213" y="233" width="50" height="50" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAZCAYAAAArK+5dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAK T2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AU kSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXX Pues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgAB eNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAt AGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3 AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dX Lh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G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Gs6sDAUH4e 4ishBRqmIvMESPx4NWBNDNRLpp71EIscCmiYDw5MZGA4uQBFiIUqBp9cwMCwrZGB4d0DDCnKLLh9 gIFhXSEDw5MLOJWQZ8GTCxCDbx8gqJQ0C949gAQFWjhTbsH3DwwM2xsZGLY1ULHCgeVSPOFLmQ8o NHi0RiPJggm0tAAwALJMOov2khwjAAAAAElFTkSuQmCC"/> <animateTransform xlink:href="#img_id" begin="1s" values="-238,-258; 0,0" dur="0.5s" type="translate" attributeName="transform" fill="freeze" additive="sum"/> <animateTransform xlink:href="#img_id" begin="1s" values="2; 1" dur="0.5s" type="scale" attributeName="transform" fill="freeze" additive="sum"/> </svg>
SVG animation scaling while keeping the group from moving on one end
I am trying to use svg animation to get a dragonfly to flap its wings. I am doing this by scaling the left and right wing on the x axis. the problem is when I scale it the wing moves. I want the left or right edge of the wing to stay in one spot when it scales. here is the code for one wing <g id="wing_left"> <g> <path fill="#88C9CE" d="M254.8,132.1c-66.2,6.7-130.7,21.1-193.3,47.2c-7.4,3.1-58.6,24.1-44.8,37.4 c15.2,14.8,88.3,17.3,109.3,11.3C162.6,217.8,279.4,129.7,254.8,132.1z"/> <path fill="#92D9DE" d="M237.3,113.7c-16.1,3.6-245.9-31.8-250-22.3c-11.5,26.7,38.3,51.9,56.1,58.2 c88.5,31.4,185.6,6.2,202.5-11.3C251.7,132.4,247.9,111.3,237.3,113.7z"/> <path fill="#FFFFFF" d="M-1.2,97.7c9.1-4.5,84.8,7.2,83.7,7.1c-16.4-1.7-49.9-3.3-56.9-3.5c-32.2-1.2-24,7.4-22.5,11.8 C5,118.4-7.2,100.6-1.2,97.7z"/> <path fill="#76B0B3" d="M249.3,145.5c-2.9,3-8,7.3-11.5,10.2c-21.1,17.5-102.1,8.9-102.1,8.9s54.5-2.2,86-13.4 c13.2-4.7,21-10.2,23.2-12c0,0,1.1,1.4,2.1,2.5c1,1.1,2.3,1.8,2.3,1.8S249.3,145.5,249.3,145.5z"/> </g> <animateTransform id="wlFlapDown" attributeName="transform" type="scale" from="1 1" to="0.5 1" begin="0s;wlFlapUp.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> <animateTransform id="wlFlapUp" attributeName="transform" type="scale" from="0.5 1" to="1 1" begin="wlFlapDown.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> </g> Here is the whole svg code or you can see it in codepen <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-14.4 7.7 550.5 426.8" enable-background="new -14.4 7.7 550.5 426.8" xml:space="preserve"> <g id="wing_left"> <g> <path fill="#88C9CE" d="M254.8,132.1c-66.2,6.7-130.7,21.1-193.3,47.2c-7.4,3.1-58.6,24.1-44.8,37.4 c15.2,14.8,88.3,17.3,109.3,11.3C162.6,217.8,279.4,129.7,254.8,132.1z"/> <path fill="#92D9DE" d="M237.3,113.7c-16.1,3.6-245.9-31.8-250-22.3c-11.5,26.7,38.3,51.9,56.1,58.2 c88.5,31.4,185.6,6.2,202.5-11.3C251.7,132.4,247.9,111.3,237.3,113.7z"/> <path fill="#FFFFFF" d="M-1.2,97.7c9.1-4.5,84.8,7.2,83.7,7.1c-16.4-1.7-49.9-3.3-56.9-3.5c-32.2-1.2-24,7.4-22.5,11.8 C5,118.4-7.2,100.6-1.2,97.7z"/> <path fill="#76B0B3" d="M249.3,145.5c-2.9,3-8,7.3-11.5,10.2c-21.1,17.5-102.1,8.9-102.1,8.9s54.5-2.2,86-13.4 c13.2-4.7,21-10.2,23.2-12c0,0,1.1,1.4,2.1,2.5c1,1.1,2.3,1.8,2.3,1.8S249.3,145.5,249.3,145.5z"/> </g> <animateTransform id="wlFlapDown" attributeName="transform" type="scale" from="1 1" to="0.5 1" begin="0s;wlFlapUp.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> <animateTransform id="wlFlapUp" attributeName="transform" type="scale" from="0.5 1" to="1 1" begin="wlFlapDown.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> </g> <g id="wing_right"> <g> <path fill="#88C9CE" d="M275.9,134c66.4,4.7,131.2,17.1,194.6,41.4c7.5,2.9,59.3,22.3,45.9,36.1c-14.8,15.2-87.7,19.9-109,14.6 C370.6,216.9,251.2,132.2,275.9,134z"/> <path fill="#92D9DE" d="M285,113c16.2,3.1,244.8-39.1,249.2-29.7c12.3,26.3-36.8,53-54.4,59.8c-87.6,34-185.4,11.7-202.8-5.2 C271.1,132.1,274.2,110.9,285,113z"/> <path fill="#FFFFFF" d="M451.2,98.5c25.6-4.3,28.9-4.8,58.9-8.8c1.9-0.3,16.3-1.3,15.6,4.3c-0.2,1.4-6.5,17.8-6,13.2 c0.1-0.8,0.9-9.8-1.3-12.5C513.9,88.7,445.7,99.5,451.2,98.5z"/> <path fill="#76B0B3" d="M291.3,155.4c21.9,16.6,99.9,5.4,99.9,5.4s-54.7-0.2-86.7-9.9c-13.4-4.1-22.5-9.1-24.1-10.3 c0,0-0.8,0.9-1.8,1.6c0,0,0.1,2.2,0.1,2.2S287.6,152.7,291.3,155.4z"/> </g> <animateTransform id="wrFlapDown" attributeName="transform" type="scale" from="1 1" to="0.5 1" begin="0s; wrFlapUp.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> <animateTransform id="wrFlapDown" attributeName="transform" type="scale" from="0.5 1" to="1 1" begin="wrFlapDown.end" dur="160ms" repeatCount="indefinite" fill="freeze" /> </g> <g id="body" xmlns:inkpad="http://taptrix.com/inkpad/svg_extensions"> <g id="Layer_2" inkpad:layerName="body"> <path fill="#D9AC32" d="M253.8,83.2c-4.5-29.5-6.4-53.2-16-74.7c-0.8-1.9-4.3,1-3.4,1.6c0.4,0.2,12.6,13.5,17.3,73.2 C252.2,88.9,254.5,87.3,253.8,83.2z"/> <path fill="#D9AC32" d="M272.2,82.6c5.2-29.3,7.8-53,17.9-74.3c0.9-1.9,4.3,1.1,3.3,1.7c-0.4,0.2-12.9,13.2-19.1,72.7 C273.7,88.2,271.5,86.6,272.2,82.6z"/> <path fill="#FFE008" d="M249.8,128.8l28.2-0.4c0,0,10.4,208,2.7,260.4c-10.3,71.1-18.9,49.7-27.9,0.4 C243.4,337.1,249.8,128.8,249.8,128.8z"/> <path fill="#FFE008" d="M242.5,130.2c-0.2-12,9-21.8,20.6-22c11.5-0.2,21.1,9.4,21.2,21.4c0.2,12-9.7,17-21.2,17.2 C251.5,146.9,242.7,142.2,242.5,130.2z"/> <path fill="#FFE008" d="M236.8,110.7c-0.3-18.4,12-32.8,26.5-33c14.5-0.2,25.8,13.9,26.1,32.2c0.3,18.4-11.7,25.1-26.3,25.3 C248.6,135.4,237.1,129,236.8,110.7z"/> </g> <g id="Layer_3" inkpad:layerName="eyes"> <g> <path fill="#F5F2E1" d="M227.8,95.9c-0.1-8.3,7.2-15.1,16.4-15.3c9.2-0.1,16.7,6.5,16.8,14.8c0.1,8.3-7.2,15.1-16.4,15.3 C235.4,110.9,227.9,104.2,227.8,95.9z"/> <path d="M255.1,92c-0.6,1.6-7.3-5.5-19.7,3.7c-2.4,1.8-1.8-4.6-0.1-6C244.1,82.6,255.8,90.4,255.1,92z"/> <path fill="#D8E6C3" d="M228,96.2c-0.1-5.4,2.1,9.9,15.5,11.1c8.1,0.7,14.5-2.9,14.2-2.5c-3.9,4.4-9,5.5-10.5,5.7 C236.8,111.8,228.2,106.5,228,96.2z"/> </g> <g> <path fill="#F5F2E1" d="M295.8,94.9c-0.1-8.3-7.7-14.9-16.8-14.8c-9.2,0.1-16.5,7-16.4,15.3c0.1,8.3,7.7,14.9,16.8,14.8 C288.6,110.1,295.9,103.2,295.8,94.9z"/> <path d="M268.3,91.8c0.7,1.6,7.1-5.7,19.8,3.1c2.5,1.7,1.7-4.7-0.1-6C279.1,82.1,267.6,90.3,268.3,91.8z"/> <path fill="#D8E6C3" d="M295.5,95.2c-0.1-5.4-1.8,9.9-15.2,11.5c-8.1,1-14.6-2.5-14.3-2.1c4,4.3,9.2,5.2,10.7,5.4 C287.2,111,295.7,105.5,295.5,95.2z"/> </g> </g> <path fill="#E5C907" d="M242.6,127.9c0-0.1,4.8,8.1,22.5,7.2c13.6-0.7,19-8.1,19-8.1c-0.4,4.9-11.3,11.2-18.3,11.6 C260.3,139,247.3,137.3,242.6,127.9z"/> <path fill="#E5C907" d="M249.3,143.6c0,0,6,3.9,15,3.2c10.4-0.8,14.4-4.7,14.4-4.6c0.2,4.1,0.5,8.3,0.4,8.6 c-3.5,7.1-20.6,9.4-29.8,2C249,152.5,249.3,147.1,249.3,143.6z"/> </g> </svg>
The problem here is that the origin for all scale transforms is at (0,0) which is at the top left of the SVG. So your scale animations are centred on the left side of the SVG (x=0). Basically you need to move the coordinate space for the wings, so that when the scale is applied, the wings are centred on x=0. So the steps would be: Use a translate transform to move your wings so they are centred at x=0 apply your scale animation in this coordinate space surround that with a group with a transform that moves them back to their original position For example: <g id="wings" transform="translate(270,0)"> <g> <g transform="translate(-270,0)"> <g "left wing"> <g "right wing"> </g> <animateTransform .../> </g> </g> Demo here