5 background-color: yellow;
10 background-color: green;
11 -webkit-transition-property: background-color;
12 -webkit-transition-duration:
5s;
18 -webkit-transition-property: height;
19 -webkit-transition-duration:
2s;
23 When you click the Change button, the shape will
24 <span id=
"description"></span>.
25 <button style=
"display: block;" onclick=
"transition()">Change
</button>
27 <div id=
"target"></div>
31 {className
:"green", description
:"instantly change into a rectangle and fade from yellow to green over 5 seconds"},
32 {className
:"", description
:"instantly change into a small yellow square"},
33 {className
:"square", description
:"instantly change into a yellow rectangle and then animate into a big yellow square over 2 seconds"},
34 {className
:"green", description
:"instantly change into a yellow rectangle and then animate to a green rectangle over 5 seconds"},
35 {className
:"", description
:"instantly change into a small yellow square"},
36 {className
:"green", description
:"instantly change into a yellow rectangle and fade from yellow to green over 5 seconds"},
37 {className
:"square", description
:"instantly change to a yellow rectangle and then animate into a large yellow square over 2 seconds"},
38 {className
:"", description
:"instantly change into a small yellow square"}
41 document
.getElementById("description").innerText
= transitions
[0].description
;
45 var target
= document
.getElementById("target");
46 target
.className
= transitions
[state
].className
;
48 if (state
< transitions
.length
)
49 document
.getElementById("description").innerText
= transitions
[state
].description
;
51 document
.getElementById("instructions").innerText
= "Done.";