polymer-paper-elements-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
  5. data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
  6. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  7. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  8. data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
  9. data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
  10. data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
  11. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  12. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  13. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  14. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  15. data/app/assets/components/iron-icon/hero.svg +19 -0
  16. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  17. data/app/assets/components/iron-icons/av-icons.html +73 -0
  18. data/app/assets/components/iron-icons/communication-icons.html +59 -0
  19. data/app/assets/components/iron-icons/device-icons.html +94 -0
  20. data/app/assets/components/iron-icons/editor-icons.html +70 -0
  21. data/app/assets/components/iron-icons/hardware-icons.html +61 -0
  22. data/app/assets/components/iron-icons/hero.svg +35 -0
  23. data/app/assets/components/iron-icons/image-icons.html +164 -0
  24. data/app/assets/components/iron-icons/iron-icons.html +303 -0
  25. data/app/assets/components/iron-icons/maps-icons.html +71 -0
  26. data/app/assets/components/iron-icons/notification-icons.html +62 -0
  27. data/app/assets/components/iron-icons/social-icons.html +40 -0
  28. data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
  29. data/app/assets/components/iron-input/hero.svg +19 -0
  30. data/app/assets/components/iron-input/iron-input.html +235 -0
  31. data/app/assets/components/iron-media-query/hero.svg +29 -0
  32. data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
  33. data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
  34. data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
  35. data/app/assets/components/iron-meta/hero.svg +33 -0
  36. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  37. data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
  38. data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
  39. data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
  40. data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
  41. data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
  42. data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
  43. data/app/assets/components/iron-selector/iron-selectable.html +307 -0
  44. data/app/assets/components/iron-selector/iron-selection.html +115 -0
  45. data/app/assets/components/iron-selector/iron-selector.html +71 -0
  46. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
  47. data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
  48. data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
  49. data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
  50. data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
  51. data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
  52. data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
  53. data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
  54. data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
  55. data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
  56. data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
  57. data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
  58. data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
  59. data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
  60. data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
  61. data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
  62. data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
  63. data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
  64. data/app/assets/components/neon-animation/neon-animatable.html +54 -0
  65. data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
  66. data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
  67. data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
  68. data/app/assets/components/neon-animation/neon-animation.html +17 -0
  69. data/app/assets/components/neon-animation/neon-animations.html +25 -0
  70. data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
  71. data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
  72. data/app/assets/components/neon-animation/web-animations.html +11 -0
  73. data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
  74. data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
  75. data/app/assets/components/paper-button/paper-button.html +177 -0
  76. data/app/assets/components/paper-checkbox/metadata.html +17 -0
  77. data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
  78. data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
  79. data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
  80. data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
  81. data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
  82. data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
  83. data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
  84. data/app/assets/components/paper-dialog/hero.svg +58 -0
  85. data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
  86. data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
  87. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
  88. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
  89. data/app/assets/components/paper-fab/paper-fab.html +159 -0
  90. data/app/assets/components/paper-header-panel/hero.svg +38 -0
  91. data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
  92. data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
  93. data/app/assets/components/paper-input/all-imports.html +12 -0
  94. data/app/assets/components/paper-input/hero.svg +19 -0
  95. data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
  96. data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
  97. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  98. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  99. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  100. data/app/assets/components/paper-input/paper-input.html +126 -0
  101. data/app/assets/components/paper-input/paper-textarea.html +100 -0
  102. data/app/assets/components/paper-item/all-imports.html +13 -0
  103. data/app/assets/components/paper-item/paper-icon-item.html +86 -0
  104. data/app/assets/components/paper-item/paper-item-body.html +93 -0
  105. data/app/assets/components/paper-item/paper-item-shared.css +19 -0
  106. data/app/assets/components/paper-item/paper-item.html +95 -0
  107. data/app/assets/components/paper-material/paper-material.html +98 -0
  108. data/app/assets/components/paper-menu/hero.svg +35 -0
  109. data/app/assets/components/paper-menu/paper-menu.html +133 -0
  110. data/app/assets/components/paper-progress/hero.svg +21 -0
  111. data/app/assets/components/paper-progress/paper-progress.html +199 -0
  112. data/app/assets/components/paper-radio-button/hero.svg +22 -0
  113. data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
  114. data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
  115. data/app/assets/components/paper-radio-group/hero.svg +25 -0
  116. data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
  117. data/app/assets/components/paper-ripple/hero.svg +30 -0
  118. data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
  119. data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
  120. data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
  121. data/app/assets/components/paper-slider/hero.svg +20 -0
  122. data/app/assets/components/paper-slider/paper-slider.css +252 -0
  123. data/app/assets/components/paper-slider/paper-slider.html +449 -0
  124. data/app/assets/components/paper-spinner/hero.svg +27 -0
  125. data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
  126. data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
  127. data/app/assets/components/paper-styles/classes/global.html +96 -0
  128. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  129. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  130. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  131. data/app/assets/components/paper-styles/color.html +333 -0
  132. data/app/assets/components/paper-styles/default-theme.html +39 -0
  133. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  134. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  135. data/app/assets/components/paper-styles/shadow.html +61 -0
  136. data/app/assets/components/paper-styles/typography.html +240 -0
  137. data/app/assets/components/paper-tabs/hero.svg +23 -0
  138. data/app/assets/components/paper-tabs/paper-tab.html +158 -0
  139. data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
  140. data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
  141. data/app/assets/components/paper-toast/hero.svg +20 -0
  142. data/app/assets/components/paper-toast/paper-toast.html +164 -0
  143. data/app/assets/components/paper-toggle-button/hero.svg +22 -0
  144. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
  145. data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
  146. data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
  147. data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
  148. data/app/assets/components/polymer-gestures/banner.txt +9 -0
  149. data/app/assets/components/polymer-gestures/build.json +17 -0
  150. data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
  151. data/app/assets/components/polymer-gestures/package.json +20 -0
  152. data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
  153. data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
  154. data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
  155. data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
  156. data/app/assets/components/polymer-gestures/src/hold.js +129 -0
  157. data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
  158. data/app/assets/components/polymer-gestures/src/ms.js +80 -0
  159. data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
  160. data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
  161. data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
  162. data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
  163. data/app/assets/components/polymer-gestures/src/scope.js +10 -0
  164. data/app/assets/components/polymer-gestures/src/tap.js +103 -0
  165. data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
  166. data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
  167. data/app/assets/components/polymer-gestures/src/touch.js +341 -0
  168. data/app/assets/components/polymer-gestures/src/track.js +230 -0
  169. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  170. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  171. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  172. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  173. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  174. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  175. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  176. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  177. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  178. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  179. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  180. data/app/assets/components/webcomponentsjs/package.json +31 -0
  181. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  182. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  183. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  184. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  185. data/lib/polymer-paper-elements-rails.rb +2 -0
  186. data/lib/polymer-paper-elements-rails/engine.rb +4 -0
  187. data/lib/polymer-paper-elements-rails/version.rb +3 -0
  188. metadata +272 -0
@@ -0,0 +1,61 @@
1
+ <!--
2
+ @license
3
+ Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4
+ This code may only be used under the BSD style license found at http://polymer.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/CONTRIBUTORS.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/PATENTS.txt
9
+ -->
10
+
11
+ <link rel="import" href="../../polymer/polymer.html">
12
+ <link rel="import" href="../neon-animation-behavior.html">
13
+ <link rel="import" href="../web-animations.html">
14
+
15
+ <!--
16
+ `<slide-down-animation>` animates a custom transform on an element. Use this to animate multiple
17
+ transform properties, or to apply a custom transform value.
18
+
19
+ Configuration:
20
+ ```
21
+ {
22
+ name: 'slide-down-animation',
23
+ node: <node>,
24
+ transformOrigin: <transform-origin>,
25
+ transformFrom: <transform-from-string>,
26
+ transformTo: <transform-to-string>,
27
+ timing: <animation-timing>
28
+ }
29
+ ```
30
+ -->
31
+
32
+ <script>
33
+
34
+ Polymer({
35
+
36
+ is: 'transform-animation',
37
+
38
+ behaviors: [
39
+ Polymer.NeonAnimationBehavior
40
+ ],
41
+
42
+ configure: function(config) {
43
+ var node = config.node;
44
+ var transformFrom = config.transformFrom || 'none';
45
+ var transformTo = config.transformTo || 'none';
46
+
47
+ if (config.transformOrigin) {
48
+ this.setPrefixedProperty(node, 'transformOrigin', config.transformOrigin);
49
+ }
50
+
51
+ this._effect = new KeyframeEffect(node, [
52
+ {'transform': transformFrom},
53
+ {'transform': transformTo}
54
+ ], this.timingFromConfig(config));
55
+
56
+ return this._effect;
57
+ }
58
+
59
+ });
60
+
61
+ </script>
@@ -0,0 +1,313 @@
1
+ ---
2
+ title: neon-animation
3
+ summary: "A short guide to neon-animation and neon-animated-pages"
4
+ tags: ['animation','core-animated-pages']
5
+ elements: ['neon-animation','neon-animated-pages']
6
+ updated: 2015-05-26
7
+ ---
8
+
9
+ # neon-animation
10
+
11
+ `neon-animation` is a suite of elements and behaviors to implement pluggable animated transitions for Polymer Elements using [Web Animations](https://w3c.github.io/web-animations/).
12
+
13
+ *Warning: The API may change.*
14
+
15
+ * [A basic animatable element](#basic)
16
+ * [Animation configuration](#configuration)
17
+ * [Animation types](#configuration-types)
18
+ * [Configuration properties](#configuration-properties)
19
+ * [Using multiple animations](#configuration-multiple)
20
+ * [Running animations encapsulated in children nodes](#configuration-encapsulation)
21
+ * [Page transitions](#page-transitions)
22
+ * [Shared element animations](#shared-element)
23
+ * [Declarative page transitions](#declarative-page)
24
+ * [Included animations](#animations)
25
+ * [Demos](#demos)
26
+
27
+ <a name="basic"></a>
28
+ ## A basic animatable element
29
+
30
+ Elements that can be animated should implement the `Polymer.NeonAnimatableBehavior` behavior, or `Polymer.NeonAnimationRunnerBehavior` if they're also responsible for running an animation.
31
+
32
+ ```js
33
+ Polymer({
34
+ is: 'my-animatable',
35
+ behaviors: [
36
+ Polymer.NeonAnimationRunnerBehavior
37
+ ],
38
+ properties: {
39
+ animationConfig: {
40
+ value: function() {
41
+ return {
42
+ // provided by neon-animation/animations/scale-down-animation.html
43
+ name: 'scale-down-animation',
44
+ node: this
45
+ }
46
+ }
47
+ }
48
+ },
49
+ listeners: {
50
+ // this event is fired when the animation finishes
51
+ 'neon-animation-finish': '_onNeonAnimationFinish'
52
+ },
53
+ animate: function() {
54
+ // run scale-down-animation
55
+ this.playAnimation();
56
+ },
57
+ _onNeonAnimationFinish: function() {
58
+ console.log('animation done!');
59
+ }
60
+ });
61
+ ```
62
+
63
+ [Live demo](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/doc/basic.html)
64
+
65
+ <a name="configuration"></a>
66
+ ## Animation configuration
67
+
68
+ <a name="configuration-types"></a>
69
+ ### Animation types
70
+
71
+ An element might run different animations, for example it might do something different when it enters the view and when it exits from view. You can set the `animationConfig` property to a map from an animation type to configuration.
72
+
73
+ ```js
74
+ Polymer({
75
+ is: 'my-dialog',
76
+ behaviors: [
77
+ Polymer.NeonAnimationRunnerBehavior
78
+ ],
79
+ properties: {
80
+ opened: {
81
+ type: Boolean
82
+ },
83
+ animationConfig: {
84
+ value: function() {
85
+ return {
86
+ 'entry': {
87
+ // provided by neon-animation/animations/scale-up-animation.html
88
+ name: 'scale-up-animation',
89
+ node: this
90
+ },
91
+ 'exit': {
92
+ // provided by neon-animation-animations/fade-out-animation.html
93
+ name: 'fade-out-animation',
94
+ node: this
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
100
+ listeners: {
101
+ 'neon-animation-finish': '_onNeonAnimationFinish'
102
+ },
103
+ show: function() {
104
+ this.opened = true;
105
+ this.style.display = 'inline-block';
106
+ // run scale-up-animation
107
+ this.playAnimation('entry');
108
+ },
109
+ hide: function() {
110
+ this.opened = false;
111
+ // run fade-out-animation
112
+ this.playAnimation('fade-out-animation');
113
+ },
114
+ _onNeonAnimationFinish: function() {
115
+ if (!this.opened) {
116
+ this.style.display = 'none';
117
+ }
118
+ }
119
+ });
120
+ ```
121
+
122
+ [Live demo](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/doc/types.html)
123
+
124
+ You can also use the convenience properties `entryAnimation` and `exitAnimation` to set `entry` and `exit` animations:
125
+
126
+ ```js
127
+ properties: {
128
+ entryAnimation: {
129
+ value: 'scale-up-animation'
130
+ },
131
+ exitAnimation: {
132
+ value: 'fade-out-animation'
133
+ }
134
+ }
135
+ ```
136
+
137
+ <a name="configuration-properties"></a>
138
+ ### Configuration properties
139
+
140
+ You can pass additional parameters to configure an animation in the animation configuration object.
141
+ All animations should accept the following properties:
142
+
143
+ * `name`: The name of an animation, ie. an element implementing `Polymer.NeonAnimationBehavior`.
144
+ * `node`: The target node to apply the animation to. Defaults to `this`.
145
+ * `timing`: Timing properties to use in this animation. They match the [Web Animations Animation Effect Timing interface](https://w3c.github.io/web-animations/#the-animationeffecttiming-interface). The
146
+ properties include the following:
147
+ * `duration`: The duration of the animation in milliseconds.
148
+ * `delay`: The delay before the start of the animation in milliseconds.
149
+ * `easing`: A timing function for the animation. Matches the CSS timing function values.
150
+
151
+ Animations may define additional configuration properties and they are listed in their documentation.
152
+
153
+ <a name="configuration-multiple"></a>
154
+ ### Using multiple animations
155
+
156
+ Set the animation configuration to an array to combine animations, like this:
157
+
158
+ ```js
159
+ animationConfig: {
160
+ value: function() {
161
+ return {
162
+ // fade-in-animation is run with a 50ms delay from slide-down-animation
163
+ 'entry': [{
164
+ name: 'slide-down-animation',
165
+ node: this
166
+ }, {
167
+ name: 'fade-in-animation',
168
+ node: this,
169
+ timing: {delay: 50}
170
+ }]
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ <a name="configuration-encapsulation"></a>
177
+ ### Running animations encapsulated in children nodes
178
+
179
+ You can include animations in the configuration that are encapsulated in a child element that implement `Polymer.NeonAnimatableBehavior` with the `animatable` property.
180
+
181
+ ```js
182
+ animationConfig: {
183
+ value: function() {
184
+ return {
185
+ // run fade-in-animation on this, and the entry animation on this.$.myAnimatable
186
+ 'entry': [
187
+ {name: 'fade-in-animation', node: this},
188
+ {animatable: this.$.myAnimatable, type: 'entry'}
189
+ ]
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
195
+ <a name="page-transitions"></a>
196
+ ## Page transitions
197
+
198
+ *The artist formerly known as `<core-animated-pages>`*
199
+
200
+ The `neon-animated-pages` element manages a set of pages to switch between, and runs animations between the page transitions. It implements the `Polymer.IronSelectableBehavior` behavior. Each child node should implement `Polymer.NeonAnimatableBehavior` and define the `entry` and `exit` animations. During a page transition, the `entry` animation is run on the new page and the `exit` animation is run on the old page.
201
+
202
+ <a name="shared-element"></a>
203
+ ### Shared element animations
204
+
205
+ Shared element animations work on multiple nodes. For example, a "hero" animation is used during a page transition to make two elements from separate pages appear to animate as a single element. Shared element animation configurations have an `id` property that identify they belong in the same animation. Elements containing shared elements also have a `sharedElements` property defines a map from `id` to element, the element involved with the animation.
206
+
207
+ In the incoming page:
208
+
209
+ ```js
210
+ properties: {
211
+ animationConfig: {
212
+ value: function() {
213
+ return {
214
+ // the incoming page defines the 'entry' animation
215
+ 'entry': {
216
+ name: 'hero-animation',
217
+ id: 'hero',
218
+ toPage: this
219
+ }
220
+ }
221
+ }
222
+ },
223
+ sharedElements: {
224
+ value: function() {
225
+ return {
226
+ 'hero': this.$.hero
227
+ }
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ In the outgoing page:
234
+
235
+ ```js
236
+ properties: {
237
+ animationConfig: {
238
+ value: function() {
239
+ return {
240
+ // the outgoing page defines the 'exit' animation
241
+ 'exit': {
242
+ name: 'hero-animation',
243
+ id: 'hero',
244
+ fromPage: this
245
+ }
246
+ }
247
+ }
248
+ },
249
+ sharedElements: {
250
+ value: function() {
251
+ return {
252
+ 'hero': this.$.otherHero
253
+ }
254
+ }
255
+ }
256
+ }
257
+ ```
258
+
259
+ <a name="declarative-page"></a>
260
+ ### Declarative page transitions
261
+
262
+ For convenience, if you define the `entry-animation` and `exit-animation` attributes on `<neon-animated-pages>`, those animations will apply for all page transitions.
263
+
264
+ For example:
265
+
266
+ ```js
267
+ <neon-animated-pages id="pages" class="flex" selected="[[selected]]" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation">
268
+ <neon-animatable>1</neon-animatable>
269
+ <neon-animatable>2</neon-animatable>
270
+ <neon-animatable>3</neon-animatable>
271
+ <neon-animatable>4</neon-animatable>
272
+ <neon-animatable>5</neon-animatable>
273
+ </neon-animated-pages>
274
+ ```
275
+
276
+ The new page will slide in from the right, and the old page slide away to the left.
277
+
278
+ <a name="animations"></a>
279
+ ## Included animations
280
+
281
+ Single element animations:
282
+
283
+ * `fade-in-animation` Animates opacity from `0` to `1`.
284
+ * `fade-out-animation` Animates opacity from `1` to `0`.
285
+ * `scale-down-animation` Animates transform from `scale(1)` to `scale(0)`.
286
+ * `scale-up-animation` Animates transform from `scale(0)` to `scale(1)`.
287
+ * `slide-down-animation` Animates transform from `translateY(-100%)` to `none`.
288
+ * `slide-up-animation` Animates transform from `none` to `translateY(-100%)`.
289
+ * `slide-left-animation` Animates transform from `none` to `translateX(-100%)`;
290
+ * `slide-right-animation` Animates transform from `none` to `translateX(100%)`;
291
+ * `slide-from-left-animation` Animates transform from `translateX(-100%)` to `none`;
292
+ * `slide-from-right-animation` Animates transform from `translateX(100%)` to `none`;
293
+
294
+ * `transform-animation` Animates a custom transform.
295
+
296
+ Note that there is a restriction that only one transform animation can be applied on the same element at a time. Use the custom `transform-animation` to combine transform properties.
297
+
298
+ Shared element animations
299
+
300
+ * `hero-animation` Animates an element such that it looks like it scales and transforms from another element.
301
+ * `ripple-animation` Animates an element to full screen such that it looks like it ripples from another element.
302
+
303
+ Group animations
304
+ * `cascaded-animation` Applys an animation to an array of elements with a delay between each.
305
+
306
+ <a name="demos"></a>
307
+ ## Demos
308
+
309
+ * [Grid to full screen](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/grid/index.html)
310
+ * [Animation on load](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/load/index.html)
311
+ * [List item to detail](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/list/index.html) (For narrow width)
312
+ * [Dots to squares](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/tiles/index.html)
313
+ * [Declarative](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/declarative/index.html)
@@ -0,0 +1,156 @@
1
+ <!--
2
+ Copyright (c) 2015 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
8
+ -->
9
+
10
+ <link rel="import" href="../polymer/polymer.html">
11
+ <link rel="import" href="animations/opaque-animation.html">
12
+
13
+ <script>
14
+
15
+ /**
16
+ * `Polymer.NeonAnimatableBehavior` is implemented by elements containing animations for use with
17
+ * elements implementing `Polymer.NeonAnimationRunnerBehavior`.
18
+ * @polymerBehavior
19
+ */
20
+ Polymer.NeonAnimatableBehavior = {
21
+
22
+ properties: {
23
+
24
+ /**
25
+ * Animation configuration. See README for more info.
26
+ */
27
+ animationConfig: {
28
+ type: Object
29
+ },
30
+
31
+ /**
32
+ * Convenience property for setting an 'entry' animation. Do not set `animationConfig.entry`
33
+ * manually if using this. The animated node is set to `this` if using this property.
34
+ */
35
+ entryAnimation: {
36
+ observer: '_entryAnimationChanged',
37
+ type: String
38
+ },
39
+
40
+ /**
41
+ * Convenience property for setting an 'exit' animation. Do not set `animationConfig.exit`
42
+ * manually if using this. The animated node is set to `this` if using this property.
43
+ */
44
+ exitAnimation: {
45
+ observer: '_exitAnimationChanged',
46
+ type: String
47
+ }
48
+
49
+ },
50
+
51
+ _entryAnimationChanged: function() {
52
+ this.animationConfig = this.animationConfig || {};
53
+ if (this.entryAnimation !== 'fade-in-animation') {
54
+ // insert polyfill hack
55
+ this.animationConfig['entry'] = [{
56
+ name: 'opaque-animation',
57
+ node: this
58
+ }, {
59
+ name: this.entryAnimation,
60
+ node: this
61
+ }];
62
+ } else {
63
+ this.animationConfig['entry'] = [{
64
+ name: this.entryAnimation,
65
+ node: this
66
+ }];
67
+ }
68
+ },
69
+
70
+ _exitAnimationChanged: function() {
71
+ this.animationConfig = this.animationConfig || {};
72
+ this.animationConfig['exit'] = [{
73
+ name: this.exitAnimation,
74
+ node: this
75
+ }];
76
+ },
77
+
78
+ _copyProperties: function(config1, config2) {
79
+ // shallowly copy properties from config2 to config1
80
+ for (var property in config2) {
81
+ config1[property] = config2[property];
82
+ }
83
+ },
84
+
85
+ _cloneConfig: function(config) {
86
+ var clone = {
87
+ isClone: true
88
+ };
89
+ this._copyProperties(clone, config);
90
+ return clone;
91
+ },
92
+
93
+ _getAnimationConfigRecursive: function(type, map, allConfigs) {
94
+ if (!this.animationConfig) {
95
+ return;
96
+ }
97
+
98
+ // type is optional
99
+ var thisConfig;
100
+ if (type) {
101
+ thisConfig = this.animationConfig[type];
102
+ } else {
103
+ thisConfig = this.animationConfig;
104
+ }
105
+
106
+ if (!Array.isArray(thisConfig)) {
107
+ thisConfig = [thisConfig];
108
+ }
109
+
110
+ // iterate animations and recurse to process configurations from child nodes
111
+ if (thisConfig) {
112
+ for (var config, index = 0; config = thisConfig[index]; index++) {
113
+ if (config.animatable) {
114
+ config.animatable._getAnimationConfigRecursive(config.type || type, map, allConfigs);
115
+ } else {
116
+ if (config.id) {
117
+ var cachedConfig = map[config.id];
118
+ if (cachedConfig) {
119
+ // merge configurations with the same id, making a clone lazily
120
+ if (!cachedConfig.isClone) {
121
+ map[config.id] = this._cloneConfig(cachedConfig)
122
+ cachedConfig = map[config.id];
123
+ }
124
+ this._copyProperties(cachedConfig, config);
125
+ } else {
126
+ // put any configs with an id into a map
127
+ map[config.id] = config;
128
+ }
129
+ } else {
130
+ allConfigs.push(config);
131
+ }
132
+ }
133
+ }
134
+ }
135
+ },
136
+
137
+ /**
138
+ * An element implementing `Polymer.NeonAnimationRunnerBehavior` calls this method to configure
139
+ * an animation with an optional type. Elements implementing `Polymer.NeonAnimatableBehavior`
140
+ * should define the property `animationConfig`, which is either a configuration object
141
+ * or a map of animation type to array of configuration objects.
142
+ */
143
+ getAnimationConfig: function(type) {
144
+ var map = [];
145
+ var allConfigs = [];
146
+ this._getAnimationConfigRecursive(type, map, allConfigs);
147
+ // append the configurations saved in the map to the array
148
+ for (var key in map) {
149
+ allConfigs.push(map[key]);
150
+ }
151
+ return allConfigs;
152
+ }
153
+
154
+ };
155
+
156
+ </script>