I'm trying to use SVG animate and animateTransform -


i'm trying use svg animate , animatetransform. animations triggered using mouseover , mouseout.

the first example made, changes object colors during mouseover , mouseout events , seems work well.

in second i'm trying change rotation during mouseover , mouseout events using: fill="freeze" additive="sum".

but seems work on first mouseover, the next mouseover event fails in strange way.

i tried many time changing parameters think, maybe it's svg bug.

thanks help

this link

https://www.googledrive.com/host/0bwrlr3z6e0egy2rtwxzmvmu1y0u/test_mouse_in_out.svg

this code

<?xml version="1.0" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="842px" height="595px" viewbox="0 0 842 595" enable-background="new 0 0 842 595" xml:space="preserve" xmlns:xml="http://www.w3.org/xml/1998/namespace">     <path transform="matrix(1 0 0 1 552.381 250.537)" stroke-width="1.4834077083798625" stroke-miterlimit="3" stroke="#000000" fill="#3d70b1" d="... ">       <animatetransform xmlns="http://www.w3.org/2000/svg" attributename="transform" type="rotate" begin="mouseover" dur="1" repeatcount="1" fill="freeze" additive="sum" calcmode="spline" keysplines=".5 0 .5 1" values="0 50 25;180 50 25"/>       <animatetransform xmlns="http://www.w3.org/2000/svg" attributename="transform" type="rotate" begin="mouseout" dur="2" repeatcount="1" fill="freeze" additive="sum" calcmode="spline" keysplines=".5 0 .5 1" values="0 50 25;-180 50 25"/>     </path>     <path transform="matrix(1 0 0 1 150.733 232.565)"  stroke-width="1.0106517551310161" stroke-miterlimit="3" stroke="#000000" fill="#2128df" d="...">       <animate xmlns="http://www.w3.org/2000/svg" attributename="fill" attributetype="css" begin="mouseover" dur="0.5" restart="whennotactive" repeatcount="1" fill="freeze" to="#ff0000"/>       <animate xmlns="http://www.w3.org/2000/svg" attributename="fill" attributetype="css" begin="mouseout" dur="0.5" repeatcount="1" fill="freeze" to="#2128df"/>     </path> </svg> 

is you're trying achieve?

<?xml version="1.0" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="842px" height="595px" viewbox="0 0 842 595" enable-background="new 0 0 842 595" xml:space="preserve" xmlns:xml="http://www.w3.org/xml/1998/namespace">     <g transform="matrix(1 0 0 1 552.3817663817669 250.5378939494907)" >         <path width="100" height="193.24786324786277" stroke-width="1.4834077083798625" stroke-miterlimit="3" stroke="#000000" fill="#3d70b1" d="m49.17044074315265,-81.02222443382041 l100,0 l100,61.9415551961163 q99.5833333333336,111.38520427855761 52.11894586894584,112.22563881404236 q4.654558404558088,113.06607334952727 0,61.9415551961163 l0,0 l49.17044074315265,-81.02222443382041 z ">           <animatetransform xmlns="http://www.w3.org/2000/svg" attributename="transform" type="rotate" begin="mouseover" restart="whennotactive" dur="1" repeatcount="1" fill="freeze" additive="replace" calcmode="spline" keysplines=".5 0 .5 1" values="0 50 25;180 50 25"/>           <animatetransform xmlns="http://www.w3.org/2000/svg" attributename="transform" type="rotate" begin="mouseout" dur="2" repeatcount="1" fill="freeze" additive="sum" calcmode="spline" keysplines=".5 0 .5 1" values="0 50 25;-180 50 25"/>         </path>     </g>     <path transform="matrix(1 0 0 1 150.73359748845195 232.56562387630248)" width="202.57122507122506" height="91.53846153846155" stroke-width="1.0106517551310161" stroke-miterlimit="3" stroke="#000000" fill="#2128df" d="m182.57122507122506,0 q202.57122507122506,0 202.57122507122506,20 l202.57122507122506,71.53846153846155 q202.57122507122506,91.53846153846155 182.57122507122506,91.53846153846155 l20,91.53846153846155 q0,91.53846153846155 0,71.53846153846155 l0,20 q0,0 20,0 l182.57122507122506,0 z ">       <animate xmlns="http://www.w3.org/2000/svg" attributename="fill" attributetype="css" begin="mouseover" dur="0.5" restart="whennotactive" repeatcount="1" fill="freeze" to="#ff0000"/>       <animate xmlns="http://www.w3.org/2000/svg" attributename="fill" attributetype="css" begin="mouseout" dur="0.5" repeatcount="1" fill="freeze" to="#2128df"/>     </path> </svg> 

jsfiddle


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -