1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
7 <title>CSS Transition of SVG elements
</title>
9 <style type=
"text/css" media=
"screen">
11 -webkit-box-sizing: border-box;
16 display: inline-block;
24 background-color: silver;
25 border:
1px solid black;
34 border:
1px dotted black;
35 -webkit-transform-origin: top left; /* to match SVG */
39 border:
1px solid blue;
43 -webkit-transition-property: -webkit-transform;
44 -webkit-transition-duration:
1s;
48 <script type=
"text/javascript" charset=
"utf-8">
51 function transition() {
52 var svgElm = document.getElementById(
"target");
53 var divElm = document.getElementById(
"ref");
56 svgElm.style.webkitTransform =
"translate(75px, 25px) scale(2) rotate(45deg)";
57 divElm.style.webkitTransform =
"translate(75px, 25px) scale(2) rotate(45deg)";
60 svgElm.style.webkitTransform =
"translate(0px, 0px) scale(1) rotate(0deg)";
61 divElm.style.webkitTransform =
"translate(0px, 0px) scale(1) rotate(0deg)";
68 <h1>CSS Transition of
"-webkit-trasform" property for SVG elements
</h1>
70 <p>The element below should transition when button is clicked
</p>
71 <p>The SVG transition should be identical with the CSS one
</p>
73 <input type=
"button" value=
"Transition" onclick=
"transition()" />
77 <div class=
"container">
78 <svg xmlns=
"http://www.w3.org/2000/svg" version=
"1.1"
79 viewBox=
"0 0 200 200" style=
"width:200px; height:200px;">
80 <rect id=
"target" x=
"0" y=
"0" width=
"60" height=
"60" stroke=
"blue" fill=
"none">
86 <div class=
"container">
87 <div class=
"final box" id=
"ref">