Release 2.21.2: fix animation timing
This commit is contained in:
1 parent
c923dcc1c5
commit
554678b3c4
13 files changed
+151
-54
No files matched your search
@@ -144,6 +144,7 @@ function clearRegionAnimationClasses(root) {
|
||||
element.style.removeProperty('--animate-duration');
|
||||
element.style.removeProperty('--animate-delay');
|
||||
element.style.removeProperty('--animate-repeat');
|
||||
element.style.removeProperty('animation-delay');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -161,13 +162,16 @@ function applyAnimationStep(element, step, phase) {
|
||||
return;
|
||||
}
|
||||
|
||||
element.classList.add('animate__animated', 'animate__' + preset);
|
||||
element.style.setProperty('--animate-duration', String(Math.max(1, Number(step.duration_ms || 0) || 1000)) + 'ms');
|
||||
if (Number(step.delay_ms || 0) > 0) {
|
||||
element.style.setProperty('--animate-delay', String(Math.max(0, Number(step.delay_ms || 0))) + 'ms');
|
||||
var delayMs = phase === 'outro' ? 0 : Math.max(0, Number(step.delay_ms || 0));
|
||||
if (delayMs > 0) {
|
||||
element.style.setProperty('--animate-delay', String(delayMs) + 'ms');
|
||||
element.style.setProperty('animation-delay', String(delayMs) + 'ms');
|
||||
} else {
|
||||
element.style.removeProperty('--animate-delay');
|
||||
element.style.removeProperty('animation-delay');
|
||||
}
|
||||
element.classList.add('animate__animated', 'animate__' + preset);
|
||||
|
||||
if (phase === 'loop') {
|
||||
var repeatCount = Number(step.iterations);
|
||||
|
||||
Reference in new issue
Block a user