-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurium-animation-manager-mixin.html
55 lines (46 loc) · 1.89 KB
/
curium-animation-manager-mixin.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
<link rel="import" href="../polymer/polymer-element.html">
<!-- Alreay imported in curium-animated-pages.html -->
<!--<script src="../web-animations-js/web-animations-next-lite.min.js"></script>-->
<!-- Cannot re-import, otherwise some wire error will occur -->
<script>
window.Curium = window.Curium || {};
Curium.CuriumAnimationManagerMixin = function(superClass) {
return class extends superClass {
beforeAnimation(pageContainer, pageList, selectedPage, deselectedPage) {
return null;
}
afterAnimation(pageContainer, pageList, selectedPage, deselectedPage) {
}
_getTiming(config) {
let timing = {};
({
delay: timing.delay = 0,
direction: timing.direction = 'normal',
duration: timing.duration = 500,
easing: timing.easing = 'linear',
endDelay: timing.endDelay = 0,
fill: timing.fill = 'none',
iterationStart: timing.iterationStart = 0.0,
iterations: timing.iterations = 1
} = config);
return timing;
}
_setAnimating(pageContainer, element) {
if (pageContainer.animatingAttribute && !element.hasAttribute(pageContainer.animatingAttribute)) {
element.setAttribute(pageContainer.animatingAttribute, "");
}
if (pageContainer.animatingClass && !element.classList.contains(pageContainer.animatingClass)) {
element.classList.add(pageContainer.animatingClass);
}
}
_unsetAnimating(pageContainer, element) {
if (pageContainer.animatingAttribute && element.hasAttribute(pageContainer.animatingAttribute)) {
element.removeAttribute(pageContainer.animatingAttribute);
}
if (pageContainer.animatingClass && element.classList.contains(pageContainer.animatingClass)) {
element.classList.remove(pageContainer.animatingClass);
}
}
}
};
</script>