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,84 @@
|
|
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
|
+
`<cascaded-animation>` applies an animation on an array of elements with a delay between each.
|
17
|
+
the delay defaults to 50ms.
|
18
|
+
|
19
|
+
Configuration:
|
20
|
+
```
|
21
|
+
{
|
22
|
+
name: 'cascaded-animation',
|
23
|
+
animation: <animation-name>,
|
24
|
+
nodes: <array-of-nodes>,
|
25
|
+
nodedelay: <node-delay-in-ms>,
|
26
|
+
timing: <animation-timing>
|
27
|
+
}
|
28
|
+
```
|
29
|
+
-->
|
30
|
+
|
31
|
+
<script>
|
32
|
+
|
33
|
+
Polymer({
|
34
|
+
|
35
|
+
is: 'cascaded-animation',
|
36
|
+
|
37
|
+
behaviors: [
|
38
|
+
Polymer.NeonAnimationBehavior
|
39
|
+
],
|
40
|
+
|
41
|
+
properties: {
|
42
|
+
|
43
|
+
_animationMeta: {
|
44
|
+
type: Object,
|
45
|
+
value: function() {
|
46
|
+
return new Polymer.IronMeta({type: 'animation'});
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
},
|
51
|
+
|
52
|
+
configure: function(config) {
|
53
|
+
var animationConstructor = this._animationMeta.byKey(config.animation);
|
54
|
+
if (!animationConstructor) {
|
55
|
+
console.warn(this.is + ':', 'constructor for', config.animation, 'not found!');
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
|
59
|
+
var nodes = config.nodes;
|
60
|
+
var effects = [];
|
61
|
+
var nodeDelay = config.nodeDelay || 50;
|
62
|
+
|
63
|
+
config.timing = config.timing || {};
|
64
|
+
config.timing.delay = config.timing.delay || 0;
|
65
|
+
|
66
|
+
var oldDelay = config.timing.delay;
|
67
|
+
for (var node, index = 0; node = nodes[index]; index++) {
|
68
|
+
config.timing.delay += nodeDelay;
|
69
|
+
config.node = node;
|
70
|
+
|
71
|
+
var animation = new animationConstructor();
|
72
|
+
var effect = animation.configure(config);
|
73
|
+
|
74
|
+
effects.push(effect);
|
75
|
+
}
|
76
|
+
config.timing.delay = oldDelay;
|
77
|
+
|
78
|
+
this._effect = new GroupEffect(effects);
|
79
|
+
return this._effect;
|
80
|
+
}
|
81
|
+
|
82
|
+
});
|
83
|
+
|
84
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
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
|
+
`<fade-in-animation>` animates the opacity of an element from 0 to 1.
|
17
|
+
|
18
|
+
Configuration:
|
19
|
+
```
|
20
|
+
{
|
21
|
+
name: 'fade-in-animation',
|
22
|
+
node: <node>
|
23
|
+
timing: <animation-timing>
|
24
|
+
}
|
25
|
+
```
|
26
|
+
-->
|
27
|
+
|
28
|
+
<script>
|
29
|
+
|
30
|
+
Polymer({
|
31
|
+
|
32
|
+
is: 'fade-in-animation',
|
33
|
+
|
34
|
+
behaviors: [
|
35
|
+
Polymer.NeonAnimationBehavior
|
36
|
+
],
|
37
|
+
|
38
|
+
configure: function(config) {
|
39
|
+
var node = config.node;
|
40
|
+
this._effect = new KeyframeEffect(node, [
|
41
|
+
{'opacity': '0'},
|
42
|
+
{'opacity': '1'}
|
43
|
+
], this.timingFromConfig(config));
|
44
|
+
return this._effect;
|
45
|
+
}
|
46
|
+
|
47
|
+
});
|
48
|
+
|
49
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
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
|
+
`<fade-out-animation>` animates the opacity of an element from 1 to 0.
|
17
|
+
|
18
|
+
Configuration:
|
19
|
+
```
|
20
|
+
{
|
21
|
+
name: 'fade-out-animation',
|
22
|
+
node: <node>
|
23
|
+
timing: <animation-timing>
|
24
|
+
}
|
25
|
+
```
|
26
|
+
-->
|
27
|
+
|
28
|
+
<script>
|
29
|
+
|
30
|
+
Polymer({
|
31
|
+
|
32
|
+
is: 'fade-out-animation',
|
33
|
+
|
34
|
+
behaviors: [
|
35
|
+
Polymer.NeonAnimationBehavior
|
36
|
+
],
|
37
|
+
|
38
|
+
configure: function(config) {
|
39
|
+
var node = config.node;
|
40
|
+
this._effect = new KeyframeEffect(node, [
|
41
|
+
{'opacity': '1'},
|
42
|
+
{'opacity': '0'}
|
43
|
+
], this.timingFromConfig(config));
|
44
|
+
return this._effect;
|
45
|
+
}
|
46
|
+
|
47
|
+
});
|
48
|
+
|
49
|
+
</script>
|
@@ -0,0 +1,83 @@
|
|
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-shared-element-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<hero-animation>` is a shared element animation that scales and transform an element such that it
|
17
|
+
appears to be shared between two pages. Use this in `<neon-animated-pages>`. The source page
|
18
|
+
should use this animation in an 'exit' animation and set the `fromPage` configuration property to
|
19
|
+
itself, and the destination page should use this animation in an `entry` animation and set the
|
20
|
+
`toPage` configuration property to itself. They should also define the hero elements in the
|
21
|
+
`sharedElements` property (not a configuration property, see
|
22
|
+
`Polymer.NeonSharedElementAnimatableBehavior`).
|
23
|
+
|
24
|
+
Configuration:
|
25
|
+
```
|
26
|
+
{
|
27
|
+
name: 'hero-animation',
|
28
|
+
id: <shared-element-id>,
|
29
|
+
timing: <animation-timing>,
|
30
|
+
toPage: <node>, /* define for the destination page */
|
31
|
+
fromPage: <node>, /* define for the source page */
|
32
|
+
}
|
33
|
+
```
|
34
|
+
-->
|
35
|
+
|
36
|
+
<script>
|
37
|
+
|
38
|
+
Polymer({
|
39
|
+
|
40
|
+
is: 'hero-animation',
|
41
|
+
|
42
|
+
behaviors: [
|
43
|
+
Polymer.NeonSharedElementAnimationBehavior
|
44
|
+
],
|
45
|
+
|
46
|
+
configure: function(config) {
|
47
|
+
var shared = this.findSharedElements(config);
|
48
|
+
if (!shared) {
|
49
|
+
return null;
|
50
|
+
}
|
51
|
+
|
52
|
+
var fromRect = shared.from.getBoundingClientRect();
|
53
|
+
var toRect = shared.to.getBoundingClientRect();
|
54
|
+
|
55
|
+
var deltaLeft = fromRect.left - toRect.left;
|
56
|
+
var deltaTop = fromRect.top - toRect.top;
|
57
|
+
var deltaWidth = fromRect.width / toRect.width;
|
58
|
+
var deltaHeight = fromRect.height / toRect.height;
|
59
|
+
|
60
|
+
this.setPrefixedProperty(shared.to, 'transformOrigin', '0 0');
|
61
|
+
shared.to.style.zIndex = 10000;
|
62
|
+
shared.from.style.visibility = 'hidden';
|
63
|
+
|
64
|
+
this._effect = new KeyframeEffect(shared.to, [
|
65
|
+
{'transform': 'translate(' + deltaLeft + 'px,' + deltaTop + 'px) scale(' + deltaWidth + ',' + deltaHeight + ')'},
|
66
|
+
{'transform': 'none'}
|
67
|
+
], this.timingFromConfig(config));
|
68
|
+
|
69
|
+
return this._effect;
|
70
|
+
},
|
71
|
+
|
72
|
+
complete: function(config) {
|
73
|
+
var shared = this.findSharedElements(config);
|
74
|
+
if (!shared) {
|
75
|
+
return null;
|
76
|
+
}
|
77
|
+
shared.to.style.zIndex = '';
|
78
|
+
shared.from.style.visibility = '';
|
79
|
+
}
|
80
|
+
|
81
|
+
});
|
82
|
+
|
83
|
+
</script>
|
@@ -0,0 +1,46 @@
|
|
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
|
+
`<opaque-animation>` makes an element `opacity:1` for the duration of the animation. Used to prevent
|
17
|
+
webkit/safari from drawing a frame before an animation for elements that animate from display:none.
|
18
|
+
-->
|
19
|
+
|
20
|
+
<script>
|
21
|
+
|
22
|
+
Polymer({
|
23
|
+
|
24
|
+
is: 'opaque-animation',
|
25
|
+
|
26
|
+
behaviors: [
|
27
|
+
Polymer.NeonAnimationBehavior
|
28
|
+
],
|
29
|
+
|
30
|
+
configure: function(config) {
|
31
|
+
var node = config.node;
|
32
|
+
node.style.opacity = '0';
|
33
|
+
this._effect = new KeyframeEffect(node, [
|
34
|
+
{'opacity': '1'},
|
35
|
+
{'opacity': '1'}
|
36
|
+
], this.timingFromConfig(config));
|
37
|
+
return this._effect;
|
38
|
+
},
|
39
|
+
|
40
|
+
complete: function(config) {
|
41
|
+
config.node.style.opacity = '';
|
42
|
+
}
|
43
|
+
|
44
|
+
});
|
45
|
+
|
46
|
+
</script>
|
@@ -0,0 +1,92 @@
|
|
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-shared-element-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<ripple-animation>` scales and transform an element such that it appears to ripple from either
|
17
|
+
a shared element, or from a screen position, to full screen.
|
18
|
+
|
19
|
+
If using as a shared element animation in `<neon-animated-pages>`, use this animation in an `exit`
|
20
|
+
animation in the source page and in an `entry` animation in the destination page. Also, define the
|
21
|
+
hero elements in the `sharedElements` property (not a configuration property, see
|
22
|
+
`Polymer.NeonSharedElementAnimatableBehavior`).
|
23
|
+
|
24
|
+
If using a screen position, define the `gesture` property.
|
25
|
+
|
26
|
+
Configuration:
|
27
|
+
```
|
28
|
+
{
|
29
|
+
name: 'ripple-animation`.
|
30
|
+
id: <shared-element-id>, /* set this or gesture */
|
31
|
+
gesture: {x: <page-x>, y: <page-y>}, /* set this or id */
|
32
|
+
timing: <animation-timing>,
|
33
|
+
toPage: <node>, /* define for the destination page */
|
34
|
+
fromPage: <node>, /* define for the source page */
|
35
|
+
}
|
36
|
+
```
|
37
|
+
-->
|
38
|
+
|
39
|
+
<script>
|
40
|
+
|
41
|
+
Polymer({
|
42
|
+
|
43
|
+
is: 'ripple-animation',
|
44
|
+
|
45
|
+
behaviors: [
|
46
|
+
Polymer.NeonSharedElementAnimationBehavior
|
47
|
+
],
|
48
|
+
|
49
|
+
configure: function(config, fromPage, toPage) {
|
50
|
+
var shared = this.findSharedElements(config, fromPage, toPage);
|
51
|
+
if (!shared) {
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
|
55
|
+
var translateX, translateY;
|
56
|
+
var toRect = shared.to.getBoundingClientRect();
|
57
|
+
if (config.gesture) {
|
58
|
+
translateX = config.gesture.x - (toRect.left + (toRect.width / 2));
|
59
|
+
translateY = config.gesture.y - (toRect.left + (toRect.height / 2));
|
60
|
+
} else {
|
61
|
+
var fromRect = shared.from.getBoundingClientRect();
|
62
|
+
translateX = (fromRect.left + (fromRect.width / 2)) - (toRect.left + (toRect.width / 2));
|
63
|
+
translateY = (fromRect.top + (fromRect.height / 2)) - (toRect.left + (toRect.height / 2));
|
64
|
+
}
|
65
|
+
var translate = 'translate(' + translateX + 'px,' + translateY + 'px)';
|
66
|
+
|
67
|
+
var size = Math.max(toRect.width + Math.abs(translateX) * 2, toRect.height + Math.abs(translateY) * 2);
|
68
|
+
var diameter = Math.sqrt(2 * size * size);
|
69
|
+
var scaleX = diameter / toRect.width;
|
70
|
+
var scaleY = diameter / toRect.height;
|
71
|
+
var scale = 'scale(' + scaleX + ',' + scaleY + ')';
|
72
|
+
|
73
|
+
this.setPrefixedProperty(shared.to, 'transformOrigin', '50% 50%');
|
74
|
+
shared.to.style.borderRadius = '50%';
|
75
|
+
|
76
|
+
this._effect = new KeyframeEffect(shared.to, [
|
77
|
+
{'transform': translate + ' scale(0)'},
|
78
|
+
{'transform': translate + ' ' + scale}
|
79
|
+
], this.timingFromConfig(config));
|
80
|
+
return this._effect;
|
81
|
+
},
|
82
|
+
|
83
|
+
complete: function() {
|
84
|
+
if (this.sharedElements) {
|
85
|
+
this.setPrefixedProperty(this.sharedElements.to, 'transformOrigin', '');
|
86
|
+
this.sharedElements.to.style.borderRadius = '';
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
});
|
91
|
+
|
92
|
+
</script>
|
@@ -0,0 +1,65 @@
|
|
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
|
+
`<scale-down-animation>` animates the scale transform of an element from 1 to 0. By default it
|
17
|
+
scales in both the x and y axes.
|
18
|
+
|
19
|
+
Configuration:
|
20
|
+
```
|
21
|
+
{
|
22
|
+
name: 'scale-down-animation',
|
23
|
+
node: <node>,
|
24
|
+
axis: 'x' | 'y' | '',
|
25
|
+
transformOrigin: <transform-origin>,
|
26
|
+
timing: <animation-timing>
|
27
|
+
}
|
28
|
+
```
|
29
|
+
-->
|
30
|
+
|
31
|
+
<script>
|
32
|
+
|
33
|
+
Polymer({
|
34
|
+
|
35
|
+
is: 'scale-down-animation',
|
36
|
+
|
37
|
+
behaviors: [
|
38
|
+
Polymer.NeonAnimationBehavior
|
39
|
+
],
|
40
|
+
|
41
|
+
configure: function(config) {
|
42
|
+
var node = config.node;
|
43
|
+
|
44
|
+
if (config.transformOrigin) {
|
45
|
+
this.setPrefixedProperty(node, 'transformOrigin', config.transformOrigin);
|
46
|
+
}
|
47
|
+
|
48
|
+
var scaleProperty = 'scale(0, 0)';
|
49
|
+
if (config.axis === 'x') {
|
50
|
+
scaleProperty = 'scale(0, 1)';
|
51
|
+
} else if (config.axis === 'y') {
|
52
|
+
scaleProperty = 'scale(1, 0)';
|
53
|
+
}
|
54
|
+
|
55
|
+
this._effect = new KeyframeEffect(node, [
|
56
|
+
{'transform': 'scale(1,1)'},
|
57
|
+
{'transform': scaleProperty}
|
58
|
+
], this.timingFromConfig(config));
|
59
|
+
|
60
|
+
return this._effect;
|
61
|
+
}
|
62
|
+
|
63
|
+
});
|
64
|
+
|
65
|
+
</script>
|