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>Combined transform translate() scale()</title>
8 <style type="text/css" media="screen">
12 background-color: blue;
13 -webkit-animation-duration: 1s;
14 -webkit-animation-timing-function: linear;
15 -webkit-animation-name: anim;
17 @-webkit-keyframes anim {
18 from { transform: translate(0,0) scale(1,1); }
19 to { transform: translate(100px, 200px) scale(2,4); }
22 <script type="text/javascript" charset="utf-8">
23 if (window.testRunner) {
24 testRunner.dumpAsText();
25 testRunner.waitUntilDone();
30 const expected = [ [ 1.25,0,0,1.75,25,50 ],
31 [ 1.5,0,0,2.5,50,100 ] ];
32 const tolerance = [ 0.2,0.2,0.2,0.3,8,15 ];
33 const prop = [ "a", "b", "c", "d", "e", "f" ];
35 function isEqual(actual, desired, tolerance)
37 var diff = Math.abs(actual - desired);
38 return diff <= tolerance;
43 function snapshot(which)
45 var t = new WebKitCSSMatrix(window.getComputedStyle(document.getElementById('box')).webkitTransform);
46 for (i = 0; i < 6; ++i) {
47 if (!isEqual(t[prop[i]], expected[which][i], tolerance[i]))
48 result += "FAIL('"+prop[i]+"' was:"+t[prop[i]]+", expected:"+expected[which][i]+")";
52 if (numSnapshots == 2) {
53 document.getElementById('result').innerHTML = result || "PASS";
54 if (window.testRunner)
55 testRunner.notifyDone();
61 setTimeout("snapshot(0)", 250);
62 setTimeout("snapshot(1)", 500);
65 document.addEventListener('webkitAnimationStart', start, false);
70 This test performs an animation of the translate() and scale() operators. It animates over 1 seconds.
71 At 0.25 and 0.5 seconds it takes a snapshot and expects the result to be within range.