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,72 @@
|
|
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
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<title>iron-selector-selected-attribute</title>
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
17
|
+
|
18
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
<script src="../../web-component-tester/browser.js"></script>
|
20
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
23
|
+
<link rel="import" href="../iron-selector.html">
|
24
|
+
|
25
|
+
<style>
|
26
|
+
.iron-selected {
|
27
|
+
background: #ccc;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
|
31
|
+
</head>
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<test-fixture id="test">
|
35
|
+
<template>
|
36
|
+
<iron-selector id="selector">
|
37
|
+
<div>Item 0</div>
|
38
|
+
<div>Item 1</div>
|
39
|
+
<div>Item 2</div>
|
40
|
+
<div>Item 3</div>
|
41
|
+
<div>Item 4</div>
|
42
|
+
</iron-selector>
|
43
|
+
</template>
|
44
|
+
</test-fixture>
|
45
|
+
|
46
|
+
<script>
|
47
|
+
|
48
|
+
suite('selected attributes', function() {
|
49
|
+
|
50
|
+
var s;
|
51
|
+
|
52
|
+
setup(function () {
|
53
|
+
s = fixture('test');
|
54
|
+
});
|
55
|
+
|
56
|
+
test('custom selectedAttribute', function() {
|
57
|
+
// set selectedAttribute
|
58
|
+
s.selectedAttribute = 'myattr';
|
59
|
+
// check selected attribute (should not be there)
|
60
|
+
assert.isFalse(s.children[4].hasAttribute('myattr'));
|
61
|
+
// set selected
|
62
|
+
s.selected = 4;
|
63
|
+
// now selected attribute should be there
|
64
|
+
assert.isTrue(s.children[4].hasAttribute('myattr'));
|
65
|
+
});
|
66
|
+
|
67
|
+
});
|
68
|
+
|
69
|
+
</script>
|
70
|
+
|
71
|
+
</body>
|
72
|
+
</html>
|
@@ -0,0 +1,110 @@
|
|
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
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<title>iron-selector-template-repeat</title>
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
17
|
+
|
18
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
<script src="../../web-component-tester/browser.js"></script>
|
20
|
+
|
21
|
+
<link rel="import" href="../iron-selector.html">
|
22
|
+
|
23
|
+
<style>
|
24
|
+
.iron-selected {
|
25
|
+
background: #ccc;
|
26
|
+
}
|
27
|
+
</style>
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
|
32
|
+
<template is="dom-bind">
|
33
|
+
<iron-selector id="selector" selected="1">
|
34
|
+
<template id="t" is="dom-repeat">
|
35
|
+
<div id$="[[item.name]]">{{item.name}}</div>
|
36
|
+
</template>
|
37
|
+
</iron-selector>
|
38
|
+
</template>
|
39
|
+
|
40
|
+
<script>
|
41
|
+
|
42
|
+
suite('dom-repeat', function() {
|
43
|
+
|
44
|
+
var scope, s, t;
|
45
|
+
|
46
|
+
setup(function() {
|
47
|
+
scope = document.querySelector('template[is="dom-bind"]');
|
48
|
+
s = scope.$.selector;
|
49
|
+
t = scope.$.t;
|
50
|
+
t.items = [{name:'item0'}, {name: 'item1'}, {name: 'item2'}, {name: 'item3'}];
|
51
|
+
});
|
52
|
+
|
53
|
+
teardown(function() {
|
54
|
+
t.items = [];
|
55
|
+
});
|
56
|
+
|
57
|
+
test('supports repeated items', function(done) {
|
58
|
+
setTimeout(function() {
|
59
|
+
// check items
|
60
|
+
assert.equal(s.items.length, 4);
|
61
|
+
// check selected
|
62
|
+
assert.equal(s.selected, 1);
|
63
|
+
// check selected item
|
64
|
+
var item = s.selectedItem;
|
65
|
+
assert.equal(s.items[1], item);
|
66
|
+
// check selected class
|
67
|
+
assert.isTrue(item.classList.contains('iron-selected'));
|
68
|
+
done();
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
72
|
+
test('update items', function(done) {
|
73
|
+
setTimeout(function() {
|
74
|
+
// check items
|
75
|
+
assert.equal(s.items.length, 4);
|
76
|
+
// check selected
|
77
|
+
assert.equal(s.selected, 1);
|
78
|
+
// update items
|
79
|
+
t.items = [{name:'foo'}, {name: 'bar'}];
|
80
|
+
setTimeout(function() {
|
81
|
+
// check items
|
82
|
+
assert.equal(s.items.length, 2);
|
83
|
+
// check selected (should still honor the selected)
|
84
|
+
assert.equal(s.selected, 1);
|
85
|
+
// check selected class
|
86
|
+
assert.isTrue(s.querySelector('#bar').classList.contains('iron-selected'));
|
87
|
+
done();
|
88
|
+
});
|
89
|
+
});
|
90
|
+
});
|
91
|
+
|
92
|
+
test('set selected to something else', function(done) {
|
93
|
+
setTimeout(function() {
|
94
|
+
// set selected to something else
|
95
|
+
s.selected = 3;
|
96
|
+
// check selected item
|
97
|
+
var item = s.selectedItem;
|
98
|
+
assert.equal(s.items[3], item);
|
99
|
+
// check selected class
|
100
|
+
assert.isTrue(item.classList.contains('iron-selected'));
|
101
|
+
done();
|
102
|
+
});
|
103
|
+
});
|
104
|
+
|
105
|
+
});
|
106
|
+
|
107
|
+
</script>
|
108
|
+
|
109
|
+
</body>
|
110
|
+
</html>
|
@@ -0,0 +1,304 @@
|
|
1
|
+
# neon-animation
|
2
|
+
|
3
|
+
`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/).
|
4
|
+
|
5
|
+
*Warning: The API may change.*
|
6
|
+
|
7
|
+
* [A basic animatable element](#basic)
|
8
|
+
* [Animation configuration](#configuration)
|
9
|
+
* [Animation types](#configuration-types)
|
10
|
+
* [Configuration properties](#configuration-properties)
|
11
|
+
* [Using multiple animations](#configuration-multiple)
|
12
|
+
* [Running animations encapsulated in children nodes](#configuration-encapsulation)
|
13
|
+
* [Page transitions](#page-transitions)
|
14
|
+
* [Shared element animations](#shared-element)
|
15
|
+
* [Declarative page transitions](#declarative-page)
|
16
|
+
* [Included animations](#animations)
|
17
|
+
* [Demos](#demos)
|
18
|
+
|
19
|
+
<a name="basic"></a>
|
20
|
+
## A basic animatable element
|
21
|
+
|
22
|
+
Elements that can be animated should implement the `Polymer.NeonAnimatableBehavior` behavior, or `Polymer.NeonAnimationRunnerBehavior` if they're also responsible for running an animation.
|
23
|
+
|
24
|
+
```js
|
25
|
+
Polymer({
|
26
|
+
is: 'my-animatable',
|
27
|
+
behaviors: [
|
28
|
+
Polymer.NeonAnimationRunnerBehavior
|
29
|
+
],
|
30
|
+
properties: {
|
31
|
+
animationConfig: {
|
32
|
+
value: function() {
|
33
|
+
return {
|
34
|
+
// provided by neon-animation/animations/scale-down-animation.html
|
35
|
+
name: 'scale-down-animation',
|
36
|
+
node: this
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
},
|
41
|
+
listeners: {
|
42
|
+
// this event is fired when the animation finishes
|
43
|
+
'neon-animation-finish': '_onNeonAnimationFinish'
|
44
|
+
},
|
45
|
+
animate: function() {
|
46
|
+
// run scale-down-animation
|
47
|
+
this.playAnimation();
|
48
|
+
},
|
49
|
+
_onNeonAnimationFinish: function() {
|
50
|
+
console.log('animation done!');
|
51
|
+
}
|
52
|
+
});
|
53
|
+
```
|
54
|
+
|
55
|
+
[Live demo](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/doc/basic.html)
|
56
|
+
|
57
|
+
<a name="configuration"></a>
|
58
|
+
## Animation configuration
|
59
|
+
|
60
|
+
<a name="configuration-types"></a>
|
61
|
+
### Animation types
|
62
|
+
|
63
|
+
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.
|
64
|
+
|
65
|
+
```js
|
66
|
+
Polymer({
|
67
|
+
is: 'my-dialog',
|
68
|
+
behaviors: [
|
69
|
+
Polymer.NeonAnimationRunnerBehavior
|
70
|
+
],
|
71
|
+
properties: {
|
72
|
+
opened: {
|
73
|
+
type: Boolean
|
74
|
+
},
|
75
|
+
animationConfig: {
|
76
|
+
value: function() {
|
77
|
+
return {
|
78
|
+
'entry': {
|
79
|
+
// provided by neon-animation/animations/scale-up-animation.html
|
80
|
+
name: 'scale-up-animation',
|
81
|
+
node: this
|
82
|
+
},
|
83
|
+
'exit': {
|
84
|
+
// provided by neon-animation-animations/fade-out-animation.html
|
85
|
+
name: 'fade-out-animation',
|
86
|
+
node: this
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
},
|
92
|
+
listeners: {
|
93
|
+
'neon-animation-finish': '_onNeonAnimationFinish'
|
94
|
+
},
|
95
|
+
show: function() {
|
96
|
+
this.opened = true;
|
97
|
+
this.style.display = 'inline-block';
|
98
|
+
// run scale-up-animation
|
99
|
+
this.playAnimation('entry');
|
100
|
+
},
|
101
|
+
hide: function() {
|
102
|
+
this.opened = false;
|
103
|
+
// run fade-out-animation
|
104
|
+
this.playAnimation('fade-out-animation');
|
105
|
+
},
|
106
|
+
_onNeonAnimationFinish: function() {
|
107
|
+
if (!this.opened) {
|
108
|
+
this.style.display = 'none';
|
109
|
+
}
|
110
|
+
}
|
111
|
+
});
|
112
|
+
```
|
113
|
+
|
114
|
+
[Live demo](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/doc/types.html)
|
115
|
+
|
116
|
+
You can also use the convenience properties `entryAnimation` and `exitAnimation` to set `entry` and `exit` animations:
|
117
|
+
|
118
|
+
```js
|
119
|
+
properties: {
|
120
|
+
entryAnimation: {
|
121
|
+
value: 'scale-up-animation'
|
122
|
+
},
|
123
|
+
exitAnimation: {
|
124
|
+
value: 'fade-out-animation'
|
125
|
+
}
|
126
|
+
}
|
127
|
+
```
|
128
|
+
|
129
|
+
<a name="configuration-properties"></a>
|
130
|
+
### Configuration properties
|
131
|
+
|
132
|
+
You can pass additional parameters to configure an animation in the animation configuration object.
|
133
|
+
All animations should accept the following properties:
|
134
|
+
|
135
|
+
* `name`: The name of an animation, ie. an element implementing `Polymer.NeonAnimationBehavior`.
|
136
|
+
* `node`: The target node to apply the animation to. Defaults to `this`.
|
137
|
+
* `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
|
138
|
+
properties include the following:
|
139
|
+
* `duration`: The duration of the animation in milliseconds.
|
140
|
+
* `delay`: The delay before the start of the animation in milliseconds.
|
141
|
+
* `easing`: A timing function for the animation. Matches the CSS timing function values.
|
142
|
+
|
143
|
+
Animations may define additional configuration properties and they are listed in their documentation.
|
144
|
+
|
145
|
+
<a name="configuration-multiple"></a>
|
146
|
+
### Using multiple animations
|
147
|
+
|
148
|
+
Set the animation configuration to an array to combine animations, like this:
|
149
|
+
|
150
|
+
```js
|
151
|
+
animationConfig: {
|
152
|
+
value: function() {
|
153
|
+
return {
|
154
|
+
// fade-in-animation is run with a 50ms delay from slide-down-animation
|
155
|
+
'entry': [{
|
156
|
+
name: 'slide-down-animation',
|
157
|
+
node: this
|
158
|
+
}, {
|
159
|
+
name: 'fade-in-animation',
|
160
|
+
node: this,
|
161
|
+
timing: {delay: 50}
|
162
|
+
}]
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
```
|
167
|
+
|
168
|
+
<a name="configuration-encapsulation"></a>
|
169
|
+
### Running animations encapsulated in children nodes
|
170
|
+
|
171
|
+
You can include animations in the configuration that are encapsulated in a child element that implement `Polymer.NeonAnimatableBehavior` with the `animatable` property.
|
172
|
+
|
173
|
+
```js
|
174
|
+
animationConfig: {
|
175
|
+
value: function() {
|
176
|
+
return {
|
177
|
+
// run fade-in-animation on this, and the entry animation on this.$.myAnimatable
|
178
|
+
'entry': [
|
179
|
+
{name: 'fade-in-animation', node: this},
|
180
|
+
{animatable: this.$.myAnimatable, type: 'entry'}
|
181
|
+
]
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
```
|
186
|
+
|
187
|
+
<a name="page-transitions"></a>
|
188
|
+
## Page transitions
|
189
|
+
|
190
|
+
*The artist formerly known as `<core-animated-pages>`*
|
191
|
+
|
192
|
+
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.
|
193
|
+
|
194
|
+
<a name="shared-element"></a>
|
195
|
+
### Shared element animations
|
196
|
+
|
197
|
+
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.
|
198
|
+
|
199
|
+
In the incoming page:
|
200
|
+
|
201
|
+
```js
|
202
|
+
properties: {
|
203
|
+
animationConfig: {
|
204
|
+
value: function() {
|
205
|
+
return {
|
206
|
+
// the incoming page defines the 'entry' animation
|
207
|
+
'entry': {
|
208
|
+
name: 'hero-animation',
|
209
|
+
id: 'hero',
|
210
|
+
toPage: this
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
},
|
215
|
+
sharedElements: {
|
216
|
+
value: function() {
|
217
|
+
return {
|
218
|
+
'hero': this.$.hero
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
```
|
224
|
+
|
225
|
+
In the outgoing page:
|
226
|
+
|
227
|
+
```js
|
228
|
+
properties: {
|
229
|
+
animationConfig: {
|
230
|
+
value: function() {
|
231
|
+
return {
|
232
|
+
// the outgoing page defines the 'exit' animation
|
233
|
+
'exit': {
|
234
|
+
name: 'hero-animation',
|
235
|
+
id: 'hero',
|
236
|
+
fromPage: this
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}
|
240
|
+
},
|
241
|
+
sharedElements: {
|
242
|
+
value: function() {
|
243
|
+
return {
|
244
|
+
'hero': this.$.otherHero
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
```
|
250
|
+
|
251
|
+
<a name="declarative-page"></a>
|
252
|
+
### Declarative page transitions
|
253
|
+
|
254
|
+
For convenience, if you define the `entry-animation` and `exit-animation` attributes on `<neon-animated-pages>`, those animations will apply for all page transitions.
|
255
|
+
|
256
|
+
For example:
|
257
|
+
|
258
|
+
```js
|
259
|
+
<neon-animated-pages id="pages" class="flex" selected="[[selected]]" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation">
|
260
|
+
<neon-animatable>1</neon-animatable>
|
261
|
+
<neon-animatable>2</neon-animatable>
|
262
|
+
<neon-animatable>3</neon-animatable>
|
263
|
+
<neon-animatable>4</neon-animatable>
|
264
|
+
<neon-animatable>5</neon-animatable>
|
265
|
+
</neon-animated-pages>
|
266
|
+
```
|
267
|
+
|
268
|
+
The new page will slide in from the right, and the old page slide away to the left.
|
269
|
+
|
270
|
+
<a name="animations"></a>
|
271
|
+
## Included animations
|
272
|
+
|
273
|
+
Single element animations:
|
274
|
+
|
275
|
+
* `fade-in-animation` Animates opacity from `0` to `1`.
|
276
|
+
* `fade-out-animation` Animates opacity from `1` to `0`.
|
277
|
+
* `scale-down-animation` Animates transform from `scale(1)` to `scale(0)`.
|
278
|
+
* `scale-up-animation` Animates transform from `scale(0)` to `scale(1)`.
|
279
|
+
* `slide-down-animation` Animates transform from `translateY(-100%)` to `none`.
|
280
|
+
* `slide-up-animation` Animates transform from `none` to `translateY(-100%)`.
|
281
|
+
* `slide-left-animation` Animates transform from `none` to `translateX(-100%)`;
|
282
|
+
* `slide-right-animation` Animates transform from `none` to `translateX(100%)`;
|
283
|
+
* `slide-from-left-animation` Animates transform from `translateX(-100%)` to `none`;
|
284
|
+
* `slide-from-right-animation` Animates transform from `translateX(100%)` to `none`;
|
285
|
+
* `transform-animation` Animates a custom transform.
|
286
|
+
|
287
|
+
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.
|
288
|
+
|
289
|
+
Shared element animations
|
290
|
+
|
291
|
+
* `hero-animation` Animates an element such that it looks like it scales and transforms from another element.
|
292
|
+
* `ripple-animation` Animates an element to full screen such that it looks like it ripples from another element.
|
293
|
+
|
294
|
+
Group animations
|
295
|
+
* `cascaded-animation` Applys an animation to an array of elements with a delay between each.
|
296
|
+
|
297
|
+
<a name="demos"></a>
|
298
|
+
## Demos
|
299
|
+
|
300
|
+
* [Grid to full screen](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/grid/index.html)
|
301
|
+
* [Animation on load](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/load/index.html)
|
302
|
+
* [List item to detail](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/list/index.html) (For narrow width)
|
303
|
+
* [Dots to squares](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/tiles/index.html)
|
304
|
+
* [Declarative](http://morethanreal.github.io/neon-animation-demo/bower_components/neon-animation/demo/declarative/index.html)
|