| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 @license | |
| 3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
| 4 This code may only be used under the BSD style license found at http://polym
er.github.io/LICENSE.txt | |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
.txt | |
| 6 The complete set of contributors may be found at http://polymer.github.io/CO
NTRIBUTORS.txt | |
| 7 Code distributed by Google as part of the polymer project is also | |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/P
ATENTS.txt | |
| 9 --> | |
| 10 <!DOCTYPE html> | |
| 11 <html> | |
| 12 <head> | |
| 13 <title>core-animation</title> | |
| 14 <script src="../platform/platform.js"></script> | |
| 15 <link rel="import" href="core-animation.html"> | |
| 16 <link rel="import" href="core-animation-group.html"> | |
| 17 | |
| 18 <!-- <link rel="import" href="polymer-blink.html"> | |
| 19 <link rel="import" href="polymer-bounce.html"> | |
| 20 <link rel="import" href="polymer-fadein.html"> | |
| 21 <link rel="import" href="polymer-fadeout.html"> | |
| 22 <link rel="import" href="polymer-flip.html"> | |
| 23 <link rel="import" href="polymer-shake.html"> | |
| 24 --> | |
| 25 <style> | |
| 26 body { | |
| 27 text-align: center; | |
| 28 font-family: Helvetica, sans-serif; | |
| 29 } | |
| 30 div#target { | |
| 31 display: inline-block; | |
| 32 background-color: dimgrey; | |
| 33 border-radius: 5px; | |
| 34 padding: 5px 10px; | |
| 35 margin: 50px; | |
| 36 font-size: 30px; | |
| 37 color: white; | |
| 38 } | |
| 39 div.animations > * { | |
| 40 display: inline-block; | |
| 41 background-color: darkgrey; | |
| 42 border-radius: 5px; | |
| 43 padding: 5px 10px; | |
| 44 margin: 5px; | |
| 45 color: white; | |
| 46 } | |
| 47 </style> | |
| 48 </head> | |
| 49 <body> | |
| 50 | |
| 51 <div id="target">animated!</div> | |
| 52 | |
| 53 <div class="animations"> | |
| 54 | |
| 55 <core-animation id="raw" duration="1000"> | |
| 56 raw | |
| 57 <core-animation-keyframe> | |
| 58 <core-animation-prop name="opacity" value="1"> | |
| 59 </core-animation-prop> | |
| 60 </core-animation-keyframe> | |
| 61 <core-animation-keyframe> | |
| 62 <core-animation-prop name="opacity" value="0.3"> | |
| 63 </core-animation-prop> | |
| 64 </core-animation-keyframe> | |
| 65 <core-animation-keyframe> | |
| 66 <core-animation-prop name="opacity" value="1"> | |
| 67 </core-animation-prop> | |
| 68 </core-animation-keyframe> | |
| 69 </core-animation> | |
| 70 | |
| 71 <core-animation-group type="seq"> | |
| 72 raw group | |
| 73 <core-animation duration="300"> | |
| 74 <core-animation-keyframe> | |
| 75 <core-animation-prop name="opacity" value="1"> | |
| 76 </core-animation-prop> | |
| 77 </core-animation-keyframe> | |
| 78 <core-animation-keyframe> | |
| 79 <core-animation-prop name="opacity" value="0.3"> | |
| 80 </core-animation-prop> | |
| 81 </core-animation-keyframe> | |
| 82 <core-animation-keyframe> | |
| 83 <core-animation-prop name="opacity" value="1"> | |
| 84 </core-animation-prop> | |
| 85 </core-animation-keyframe> | |
| 86 </core-animation> | |
| 87 <core-animation duration="300"> | |
| 88 <core-animation-keyframe> | |
| 89 <core-animation-prop name="transform" value="scale(1)"> | |
| 90 </core-animation-prop> | |
| 91 </core-animation-keyframe> | |
| 92 <core-animation-keyframe> | |
| 93 <core-animation-prop name="transform" value="scale(1.2)"> | |
| 94 </core-animation-prop> | |
| 95 </core-animation-keyframe> | |
| 96 <core-animation-keyframe> | |
| 97 <core-animation-prop name="transform" value="scale(1)"> | |
| 98 </core-animation-prop> | |
| 99 </core-animation-keyframe> | |
| 100 </core-animation> | |
| 101 </core-animation-group> | |
| 102 | |
| 103 <core-animation id="custom-animation" duration="500">custom</core-animatio
n> | |
| 104 | |
| 105 <core-animation duration="1000" iterations="Infinity" direction="alternate
"> | |
| 106 infinite | |
| 107 <core-animation-keyframe> | |
| 108 <core-animation-prop name="opacity" value="1"> | |
| 109 </core-animation-prop> | |
| 110 </core-animation-keyframe> | |
| 111 <core-animation-keyframe> | |
| 112 <core-animation-prop name="opacity" value="0.3"> | |
| 113 </core-animation-prop> | |
| 114 </core-animation-keyframe> | |
| 115 </core-animation> | |
| 116 <!-- <polymer-bounce duration="1000">bounce</polymer-bounce> | |
| 117 <polymer-shake>shake</polymer-shake> | |
| 118 <polymer-flip>flip X</polymer-flip> | |
| 119 <polymer-flip axis="y">flip Y</polymer-flip> | |
| 120 <polymer-blink>blink</polymer-blink> | |
| 121 <polymer-fadein>fade in</polymer-fadein> | |
| 122 --> </div> | |
| 123 <script> | |
| 124 var customAnimationFn = function(timeFraction, target) { | |
| 125 if (timeFraction < 1) { | |
| 126 target.textContent = timeFraction; | |
| 127 } else { | |
| 128 target.textContent = 'animated!'; | |
| 129 } | |
| 130 }; | |
| 131 | |
| 132 document.addEventListener('polymer-ready', function() { | |
| 133 document.querySelector('.animations').addEventListener('click', | |
| 134 function(e) { | |
| 135 var animation = e.target; | |
| 136 if (animation.id === 'custom-animation') { | |
| 137 animation.customEffect = customAnimationFn; | |
| 138 } | |
| 139 animation.target = target; | |
| 140 animation.play(); | |
| 141 }); | |
| 142 document.getElementById('raw').addEventListener( | |
| 143 'core-animation-finish', function(e) { | |
| 144 console.log('finish!'); | |
| 145 }); | |
| 146 }); | |
| 147 </script> | |
| 148 </body> | |
| 149 </html> | |
| OLD | NEW |