polymer-neon-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-resizable-behavior/README.md +16 -0
- data/app/assets/components/iron-resizable-behavior/bower.json +26 -0
- data/app/assets/components/iron-resizable-behavior/demo/index.html +29 -0
- data/app/assets/components/iron-resizable-behavior/demo/src/x-app.html +114 -0
- data/app/assets/components/iron-resizable-behavior/index.html +25 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-resizable-behavior/test/basic.html +263 -0
- data/app/assets/components/iron-resizable-behavior/test/index.html +31 -0
- data/app/assets/components/iron-resizable-behavior/test/test-elements.html +143 -0
- data/app/assets/components/iron-selector/README.md +50 -0
- data/app/assets/components/iron-selector/bower.json +31 -0
- data/app/assets/components/iron-selector/demo/index.html +66 -0
- data/app/assets/components/iron-selector/index.html +28 -0
- data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
- data/app/assets/components/iron-selector/iron-selectable.html +307 -0
- data/app/assets/components/iron-selector/iron-selection.html +115 -0
- data/app/assets/components/iron-selector/iron-selector.html +71 -0
- data/app/assets/components/iron-selector/test/activate-event.html +138 -0
- data/app/assets/components/iron-selector/test/basic.html +150 -0
- data/app/assets/components/iron-selector/test/content-element.html +43 -0
- data/app/assets/components/iron-selector/test/content.html +168 -0
- data/app/assets/components/iron-selector/test/index.html +36 -0
- data/app/assets/components/iron-selector/test/multi.html +135 -0
- data/app/assets/components/iron-selector/test/next-previous.html +134 -0
- data/app/assets/components/iron-selector/test/selected-attribute.html +72 -0
- data/app/assets/components/iron-selector/test/template-repeat.html +110 -0
- data/app/assets/components/neon-animation/README.md +304 -0
- data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
- data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
- data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
- data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
- data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
- data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
- data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
- data/app/assets/components/neon-animation/bower.json +51 -0
- data/app/assets/components/neon-animation/demo/declarative/index.html +108 -0
- data/app/assets/components/neon-animation/demo/doc/basic.html +47 -0
- data/app/assets/components/neon-animation/demo/doc/my-animatable.html +73 -0
- data/app/assets/components/neon-animation/demo/doc/my-dialog.html +97 -0
- data/app/assets/components/neon-animation/demo/doc/types.html +53 -0
- data/app/assets/components/neon-animation/demo/dropdown/animated-dropdown.html +97 -0
- data/app/assets/components/neon-animation/demo/dropdown/index.html +54 -0
- data/app/assets/components/neon-animation/demo/grid/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/grid/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/grid/index.html +70 -0
- data/app/assets/components/neon-animation/demo/index.html +6 -0
- data/app/assets/components/neon-animation/demo/list/full-view.html +122 -0
- data/app/assets/components/neon-animation/demo/list/index.html +29 -0
- data/app/assets/components/neon-animation/demo/list/list-demo.html +112 -0
- data/app/assets/components/neon-animation/demo/list/list-view.html +127 -0
- data/app/assets/components/neon-animation/demo/load/animated-grid.html +147 -0
- data/app/assets/components/neon-animation/demo/load/full-page.html +86 -0
- data/app/assets/components/neon-animation/demo/load/index.html +45 -0
- data/app/assets/components/neon-animation/demo/reprojection/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/reprojection/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/reprojection/index.html +66 -0
- data/app/assets/components/neon-animation/demo/reprojection/reprojected-pages.html +42 -0
- data/app/assets/components/neon-animation/demo/shared.css +40 -0
- data/app/assets/components/neon-animation/demo/tiles/circles-page.html +110 -0
- data/app/assets/components/neon-animation/demo/tiles/index.html +77 -0
- data/app/assets/components/neon-animation/demo/tiles/squares-page.html +104 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/index.html +30 -0
- data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
- data/app/assets/components/neon-animation/neon-animatable.html +54 -0
- data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
- data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
- data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
- data/app/assets/components/neon-animation/neon-animation.html +17 -0
- data/app/assets/components/neon-animation/neon-animations.html +25 -0
- data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
- data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
- data/app/assets/components/neon-animation/web-animations.html +11 -0
- data/app/assets/components/neon-elements/README.md +19 -0
- data/app/assets/components/neon-elements/bower.json +26 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/web-animations-js/COPYING +202 -0
- data/app/assets/components/web-animations-js/History.md +108 -0
- data/app/assets/components/web-animations-js/README.md +161 -0
- data/app/assets/components/web-animations-js/bower.json +31 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations.html +50 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.gz +0 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.map +1 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-neon-rails.rb +2 -0
- data/lib/polymer-neon-rails/engine.rb +4 -0
- data/lib/polymer-neon-rails/version.rb +3 -0
- metadata +264 -0
@@ -0,0 +1,110 @@
|
|
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
|
+
<link rel="import" href="../../../polymer/polymer.html">
|
10
|
+
<link rel="import" href="../../../paper-styles/paper-styles.html">
|
11
|
+
<link rel="import" href="../../neon-shared-element-animatable-behavior.html">
|
12
|
+
|
13
|
+
<dom-module id="circles-page">
|
14
|
+
|
15
|
+
<style>
|
16
|
+
|
17
|
+
:host {
|
18
|
+
@apply(--layout-horizontal);
|
19
|
+
@apply(--layout-center-center);
|
20
|
+
}
|
21
|
+
|
22
|
+
.circle {
|
23
|
+
display: inline-block;
|
24
|
+
box-sizing: border-box;
|
25
|
+
width: 100px;
|
26
|
+
height: 100px;
|
27
|
+
margin: 16px;
|
28
|
+
border-radius: 50%;
|
29
|
+
background: var(--color-one);
|
30
|
+
}
|
31
|
+
|
32
|
+
</style>
|
33
|
+
|
34
|
+
<template>
|
35
|
+
|
36
|
+
<div>
|
37
|
+
<div class="circle"></div>
|
38
|
+
<div class="circle"></div>
|
39
|
+
<div class="circle"></div>
|
40
|
+
<div class="circle"></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
</template>
|
44
|
+
|
45
|
+
</dom-module>
|
46
|
+
|
47
|
+
<script>
|
48
|
+
|
49
|
+
Polymer({
|
50
|
+
|
51
|
+
is: 'circles-page',
|
52
|
+
|
53
|
+
behaviors: [
|
54
|
+
Polymer.NeonSharedElementAnimatableBehavior
|
55
|
+
],
|
56
|
+
|
57
|
+
properties: {
|
58
|
+
|
59
|
+
animationConfig: {
|
60
|
+
value: function() {
|
61
|
+
var circles = Polymer.dom(this.root).querySelectorAll('.circle');
|
62
|
+
var circlesArray = Array.prototype.slice.call(circles);
|
63
|
+
return {
|
64
|
+
'entry': [{
|
65
|
+
name: 'cascaded-animation',
|
66
|
+
animation: 'scale-up-animation',
|
67
|
+
nodes: circlesArray
|
68
|
+
}],
|
69
|
+
|
70
|
+
'exit': [{
|
71
|
+
name: 'hero-animation',
|
72
|
+
id: 'hero',
|
73
|
+
fromPage: this
|
74
|
+
}, {
|
75
|
+
name: 'cascaded-animation',
|
76
|
+
animation: 'scale-down-animation'
|
77
|
+
}]
|
78
|
+
};
|
79
|
+
}
|
80
|
+
}
|
81
|
+
},
|
82
|
+
|
83
|
+
listeners: {
|
84
|
+
'click': '_onClick'
|
85
|
+
},
|
86
|
+
|
87
|
+
_onClick: function(event) {
|
88
|
+
var target = event.target;
|
89
|
+
if (target.classList.contains('circle')) {
|
90
|
+
// configure the page animation
|
91
|
+
this.sharedElements = {
|
92
|
+
'hero': target
|
93
|
+
};
|
94
|
+
|
95
|
+
var nodesToScale = [];
|
96
|
+
var circles = Polymer.dom(this.root).querySelectorAll('.circle');
|
97
|
+
for (var node, index = 0; node = circles[index]; index++) {
|
98
|
+
if (node !== event.target) {
|
99
|
+
nodesToScale.push(node);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
this.animationConfig['exit'][1].nodes = nodesToScale;
|
103
|
+
|
104
|
+
this.fire('circle-click');
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
});
|
109
|
+
|
110
|
+
</script>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
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
|
+
<html>
|
11
|
+
<head>
|
12
|
+
<title>neon-animated-pages demo: tiles</title>
|
13
|
+
|
14
|
+
<meta charset="utf-8">
|
15
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
16
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
17
|
+
|
18
|
+
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
|
20
|
+
<link rel="import" href="../../../paper-styles/paper-styles.html">
|
21
|
+
<link rel="import" href="../../neon-animated-pages.html">
|
22
|
+
<link rel="import" href="../../neon-animations.html">
|
23
|
+
<link rel="import" href="circles-page.html">
|
24
|
+
<link rel="import" href="squares-page.html">
|
25
|
+
|
26
|
+
<style>
|
27
|
+
|
28
|
+
body {
|
29
|
+
overflow: hidden;
|
30
|
+
}
|
31
|
+
|
32
|
+
neon-animated-pages {
|
33
|
+
height: 100%;
|
34
|
+
}
|
35
|
+
|
36
|
+
</style>
|
37
|
+
|
38
|
+
<style is="custom-style">
|
39
|
+
|
40
|
+
:root {
|
41
|
+
--color-one: #4dd0e1;
|
42
|
+
--color-two: #ff9800;
|
43
|
+
}
|
44
|
+
|
45
|
+
</style>
|
46
|
+
|
47
|
+
</head>
|
48
|
+
<body class="fullbleed">
|
49
|
+
|
50
|
+
<template is="dom-bind">
|
51
|
+
|
52
|
+
<neon-animated-pages id="pages" selected="0">
|
53
|
+
|
54
|
+
<circles-page on-circle-click="_onCircleClick"></circles-page>
|
55
|
+
|
56
|
+
<squares-page on-click="_onSquaresClick"></squares-page>
|
57
|
+
|
58
|
+
</neon-animated-pages>
|
59
|
+
|
60
|
+
</template>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
|
64
|
+
var scope = document.querySelector('template[is="dom-bind"]');
|
65
|
+
|
66
|
+
scope._onCircleClick = function(event) {
|
67
|
+
this.$.pages.selected = 1;
|
68
|
+
};
|
69
|
+
|
70
|
+
scope._onSquaresClick = function(event) {
|
71
|
+
this.$.pages.selected = 0;
|
72
|
+
};
|
73
|
+
|
74
|
+
</script>
|
75
|
+
|
76
|
+
</body>
|
77
|
+
</html>
|
@@ -0,0 +1,104 @@
|
|
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
|
+
<link rel="import" href="../../../polymer/polymer.html">
|
10
|
+
<link rel="import" href="../../../paper-styles/paper-styles.html">
|
11
|
+
<link rel="import" href="../../neon-shared-element-animatable-behavior.html">
|
12
|
+
|
13
|
+
<dom-module id="squares-page">
|
14
|
+
|
15
|
+
<style>
|
16
|
+
|
17
|
+
.header {
|
18
|
+
height: 40%;
|
19
|
+
background: var(--color-one);
|
20
|
+
}
|
21
|
+
|
22
|
+
.body {
|
23
|
+
text-align: center;
|
24
|
+
padding: 8px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.square {
|
28
|
+
display: inline-block;
|
29
|
+
width: 150px;
|
30
|
+
height: 150px;
|
31
|
+
margin: 8px;
|
32
|
+
background: var(--color-two);
|
33
|
+
}
|
34
|
+
|
35
|
+
</style>
|
36
|
+
|
37
|
+
<template>
|
38
|
+
|
39
|
+
<div id="header" class="header"></div>
|
40
|
+
|
41
|
+
<div class="body">
|
42
|
+
<div class="square"></div>
|
43
|
+
<div class="square"></div>
|
44
|
+
<div class="square"></div>
|
45
|
+
<div class="square"></div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
</template>
|
49
|
+
|
50
|
+
</dom-module>
|
51
|
+
|
52
|
+
<script>
|
53
|
+
|
54
|
+
Polymer({
|
55
|
+
|
56
|
+
is: 'squares-page',
|
57
|
+
|
58
|
+
behaviors: [
|
59
|
+
Polymer.NeonSharedElementAnimatableBehavior
|
60
|
+
],
|
61
|
+
|
62
|
+
properties: {
|
63
|
+
|
64
|
+
sharedElements: {
|
65
|
+
value: function() {
|
66
|
+
return {
|
67
|
+
'hero': this.$.header
|
68
|
+
}
|
69
|
+
}
|
70
|
+
},
|
71
|
+
|
72
|
+
animationConfig: {
|
73
|
+
value: function() {
|
74
|
+
var squares = Polymer.dom(this.root).querySelectorAll('.square');
|
75
|
+
var squaresArray = Array.prototype.slice.call(squares);
|
76
|
+
return {
|
77
|
+
'entry': [{
|
78
|
+
name: 'hero-animation',
|
79
|
+
id: 'hero',
|
80
|
+
toPage: this
|
81
|
+
}, {
|
82
|
+
name: 'cascaded-animation',
|
83
|
+
animation: 'transform-animation',
|
84
|
+
transformFrom: 'translateY(100%)',
|
85
|
+
nodes: squaresArray
|
86
|
+
}],
|
87
|
+
|
88
|
+
'exit': [{
|
89
|
+
name: 'slide-up-animation',
|
90
|
+
node: this.$.header
|
91
|
+
}, {
|
92
|
+
name: 'cascaded-animation',
|
93
|
+
animation: 'transform-animation',
|
94
|
+
transformTo: 'translateY(60vh)',
|
95
|
+
nodes: squaresArray
|
96
|
+
}]
|
97
|
+
};
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
});
|
103
|
+
|
104
|
+
</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)
|