blob: cadb1fa515537436574c5899e6aa7421cff66a36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<!doctype html>
<html>
<head>
<style type="text/css">
body { height: 1500px; }
#center {
position: fixed;
left: 40%;;
width: 50%;
height: 250px;
top: 25%;
background-color: grey;
-webkit-transform: scale(0.25, 0.25);
-webkit-transition: -webkit-transform 1s;
}
#drawer {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 120px;
background-color: red;
-webkit-transform: translate3d(-1000px, 0, 0);
-webkit-transition: -webkit-transform 1s;
}
</style>
<script>
'use strict';
window.animationDone = false;
window.addEventListener('load', function() {
var centerEl = document.querySelector('#center');
centerEl.style.webkitTransform = 'scale(1.0, 1.0)';
console.time('Interaction.CenterAnimation/is_smooth');
centerEl.addEventListener('transitionend', function() {
console.timeEnd('Interaction.CenterAnimation/is_smooth');
var drawerEl = document.querySelector('#drawer');
drawerEl.style.webkitTransform = 'translate3D(0, 0, 0)';
console.time('Interaction.DrawerAnimation/is_smooth');
drawerEl.addEventListener('transitionend', function() {
console.timeEnd('Interaction.DrawerAnimation/is_smooth');
window.animationDone = true;
});
});
});
</script>
</head>
<body>
<div id="center">
This is something in the middle.
</div>
<div id="drawer">
This is a drawer.
</div>
</body>
</html>
|