-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation-demo.html
109 lines (96 loc) · 2.42 KB
/
animation-demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="more-animations.html">
<link rel="import" href="../neon-animation/neon-animation-runner-behavior.html">
<!--
`animation-demo`
@demo demo/index.html
-->
<dom-module id="animation-demo">
<template>
<style>
#test{
width: 200px;
height: 200px;
padding: 16px;
margin: 16px;
background: #e5435a;
}
</style>
<div id="test"></div>
</template>
<script>
Polymer({
is: 'animation-demo',
/** @polymerBehavior Polymer.NeonAnimationRunnerBehavior */
behaviors: [Polymer.NeonAnimationRunnerBehavior],
properties: {
play:{
type: String,
observer: 'show'
},
duration: {
type: Number,
value: 1100,
notify: true,
reflectToAttribute: true
},
delay: {
type: Number,
value: 0,
notify: true,
reflectToAttribute: true
},
animationConfig: {
type: Object,
value: function() {
return {
'entry': [{
name: 'bounce-animation',
node: this.$.test,
timing: {
delay:0,
duration: 1100
}
}],
'exit': [{
name: 'fade-out-animation',
node: this.$.test,
timing: {
delay:100,
duration: 5000
}
}]
}
}
},
_showing: {
type: Boolean,
value: false
}
},
listeners: {
'neon-animation-finish': '_onAnimationFinish'
},
_onAnimationFinish: function(e) {
if (this._showing) {
} else {
this.style.display = '';
}
},
show: function() {
this.animationConfig.entry[0].name = this.play;
this.animationConfig.entry[0].timing = {
duration: this.duration,
delay: this.delay
};
this.$.test.style.display = 'inline-block';
this._showing = true;
this.playAnimation('entry');
},
hide: function() {
this._showing = false;
this.playAnimation('exit');
}
});
</script>
</dom-module>