2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
13 <meta charset=
"utf-8">
14 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge,chrome=1">
15 <meta name=
"viewport" content=
"width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
17 <title>core-animation
</title>
19 <script src=
"../webcomponentsjs/webcomponents.js"></script>
21 <link href=
"../font-roboto/roboto.html" rel=
"import">
22 <link href=
"../core-icon/core-icon.html" rel=
"import">
23 <link href=
"../core-icons/core-icons.html" rel=
"import">
25 <link href=
"core-animation.html" rel=
"import">
26 <link href=
"core-animation-group.html" rel=
"import">
28 <style shim-shadowdom
>
31 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
35 -webkit-tap-highlight-color: rgba(
0,
0,
0,
0);
36 -webkit-touch-callout: none;
48 html /deep/ core-icon {
54 display: inline-block;
56 -webkit-transform: translateZ(
0);
57 transform: translateZ(
0);
63 <body unresolved
onclick=
"clickAction(event);">
68 <div id=
"target" layout horizontal center
>
69 <core-icon icon=
"polymer"></core-icon>
76 <core-animation id=
"raw" duration=
"1000">
77 <core-animation-keyframe>
78 <core-animation-prop name=
"opacity" value=
"1">
79 </core-animation-prop>
80 </core-animation-keyframe>
81 <core-animation-keyframe>
82 <core-animation-prop name=
"opacity" value=
"0.3">
83 </core-animation-prop>
84 </core-animation-keyframe>
85 <core-animation-keyframe>
86 <core-animation-prop name=
"opacity" value=
"1">
87 </core-animation-prop>
88 </core-animation-keyframe>
93 group: opacity + scale
94 <core-animation-group type=
"seq">
95 <core-animation duration=
"300">
96 <core-animation-keyframe>
97 <core-animation-prop name=
"opacity" value=
"1">
98 </core-animation-prop>
99 </core-animation-keyframe>
100 <core-animation-keyframe>
101 <core-animation-prop name=
"opacity" value=
"0.3">
102 </core-animation-prop>
103 </core-animation-keyframe>
104 <core-animation-keyframe>
105 <core-animation-prop name=
"opacity" value=
"1">
106 </core-animation-prop>
107 </core-animation-keyframe>
109 <core-animation duration=
"300">
110 <core-animation-keyframe>
111 <core-animation-prop name=
"transform" value=
"scale(1)">
112 </core-animation-prop>
113 </core-animation-keyframe>
114 <core-animation-keyframe>
115 <core-animation-prop name=
"transform" value=
"scale(1.2)">
116 </core-animation-prop>
117 </core-animation-keyframe>
118 <core-animation-keyframe>
119 <core-animation-prop name=
"transform" value=
"scale(1)">
120 </core-animation-prop>
121 </core-animation-keyframe>
123 </core-animation-group>
128 <core-animation duration=
"1000" iterations=
"Infinity" direction=
"alternate">
129 <core-animation-keyframe>
130 <core-animation-prop name=
"opacity" value=
"1">
131 </core-animation-prop>
132 </core-animation-keyframe>
133 <core-animation-keyframe>
134 <core-animation-prop name=
"opacity" value=
"0.3">
135 </core-animation-prop>
136 </core-animation-keyframe>
142 <core-animation id=
"custom-animation" duration=
"500"></core-animation>
150 document
.body
.addEventListener('core-animation-finish', function(e
) {
151 console
.log('core-animation-finish');
155 target
.querySelector('span').textContent
= 'polymer';
159 var customAnimationFn = function(timeFraction
, target
) {
169 target
.querySelector('span').textContent
= timeFraction
;
173 function clickAction(e
) {
175 if (e
.target
.localName
!== 'button') {
183 var a
= t
.querySelector('core-animation,core-animation-group');
184 if (a
.id
=== 'custom-animation') {
185 a
.customEffect
= customAnimationFn
;
188 a
.target
= document
.getElementById('target');