animot-presenter 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimotPresenter.svelte +27 -9
- package/dist/cdn/animot-presenter.esm.js +5323 -5293
- package/dist/cdn/animot-presenter.min.js +8 -8
- package/dist/utils/text-animate.d.ts +6 -1
- package/dist/utils/text-animate.js +228 -177
- package/package.json +1 -1
|
@@ -371,6 +371,14 @@
|
|
|
371
371
|
const animated = animatedElements.get(elementId);
|
|
372
372
|
if (animated) animated.opacity.to(0, { duration: 0 });
|
|
373
373
|
}
|
|
374
|
+
// On entrance completion, snap inline opacity to the element's
|
|
375
|
+
// declared opacity (replaces the keyframe's fill-mode hold).
|
|
376
|
+
if (kind === 'entrance') {
|
|
377
|
+
const animated = animatedElements.get(elementId);
|
|
378
|
+
const el = elementContent.get(elementId);
|
|
379
|
+
const targetOpacity = (el as any)?.opacity ?? 1;
|
|
380
|
+
if (animated) animated.opacity.to(targetOpacity, { duration: 0 });
|
|
381
|
+
}
|
|
374
382
|
}, delayMs + durationMs + 50);
|
|
375
383
|
runtimeAnimTimersPresenter.set(key, t);
|
|
376
384
|
}
|
|
@@ -885,8 +893,9 @@
|
|
|
885
893
|
|
|
886
894
|
if (hasSlideTransition) {
|
|
887
895
|
// Phase 2 sprint-1 polish — fire per-element exit presets BEFORE
|
|
888
|
-
// the slide-level CSS transition starts
|
|
889
|
-
// the cross-fade
|
|
896
|
+
// the slide-level CSS transition starts, then WAIT for them to
|
|
897
|
+
// finish so the cross-fade doesn't swallow their visual.
|
|
898
|
+
let maxExitDur = 0;
|
|
890
899
|
for (const el of currentSlide.canvas.elements) {
|
|
891
900
|
const exitMode = el.animationConfig?.exit;
|
|
892
901
|
if (!exitMode || exitMode === 'none' || exitMode === 'fade') continue;
|
|
@@ -896,13 +905,16 @@
|
|
|
896
905
|
if (stillOnTarget) continue;
|
|
897
906
|
const dur = el.animationConfig?.exitDuration ?? el.animationConfig?.duration ?? 600;
|
|
898
907
|
presenterRegisterRuntimeAnim(el.id, 'exit', kf, dur);
|
|
899
|
-
|
|
900
|
-
// element vanishes cleanly once the runtime registry entry expires.
|
|
908
|
+
if (dur > maxExitDur) maxExitDur = dur;
|
|
901
909
|
const elId = el.id;
|
|
902
910
|
const animatedRef = animatedElements.get(elId);
|
|
903
911
|
if (animatedRef) setTimeout(() => animatedRef.opacity.to(0, { duration: 0 }), dur);
|
|
904
912
|
}
|
|
905
913
|
|
|
914
|
+
if (maxExitDur > 0) {
|
|
915
|
+
await new Promise(r => setTimeout(r, maxExitDur));
|
|
916
|
+
}
|
|
917
|
+
|
|
906
918
|
transitionClass = `transition-${transition.type}-out`;
|
|
907
919
|
await new Promise(r => setTimeout(r, duration * 0.4));
|
|
908
920
|
const newElementContent = new Map(elementContent);
|
|
@@ -1163,7 +1175,9 @@
|
|
|
1163
1175
|
if (!sequencedProps.has('perspective')) anims.push(animated.perspective.to(targetEl.perspective ?? 1000, { duration: elementDuration, easing }));
|
|
1164
1176
|
if (!sequencedProps.has('opacity')) {
|
|
1165
1177
|
const targetOpacity = (targetEl as any).opacity ?? 1;
|
|
1166
|
-
|
|
1178
|
+
const entrPreset = (targetEl as any).animationConfig?.entrance;
|
|
1179
|
+
const hasPresetEntrance = entrPreset && entrPreset !== 'fade' && entrPreset !== 'none';
|
|
1180
|
+
if (!hasPresetEntrance && animated.opacity.current !== targetOpacity) anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration, easing }));
|
|
1167
1181
|
}
|
|
1168
1182
|
const sortedSeqs = [...propertySequences].sort((a, b) => a.order - b.order);
|
|
1169
1183
|
let cumulativeDelay = 0;
|
|
@@ -1213,10 +1227,13 @@
|
|
|
1213
1227
|
anims.push(animated.contrast.to(targetEl.contrast ?? 100, { duration: elementDuration, easing }));
|
|
1214
1228
|
anims.push(animated.saturate.to(targetEl.saturate ?? 100, { duration: elementDuration, easing }));
|
|
1215
1229
|
anims.push(animated.grayscale.to(targetEl.grayscale ?? 0, { duration: elementDuration, easing }));
|
|
1216
|
-
// Opacity
|
|
1230
|
+
// Opacity. Skip when a preset entrance is configured so the
|
|
1231
|
+
// CSS keyframe owns opacity for the entire entrance.
|
|
1232
|
+
const entrPreset = (targetEl as any).animationConfig?.entrance;
|
|
1233
|
+
const hasPresetEntrance = entrPreset && entrPreset !== 'fade' && entrPreset !== 'none';
|
|
1217
1234
|
const currOpacity = animated.opacity.current;
|
|
1218
1235
|
const targetOpacity = (targetEl as any).opacity ?? 1;
|
|
1219
|
-
if (currOpacity !== targetOpacity) {
|
|
1236
|
+
if (!hasPresetEntrance && currOpacity !== targetOpacity) {
|
|
1220
1237
|
anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration, easing }));
|
|
1221
1238
|
}
|
|
1222
1239
|
}
|
|
@@ -1283,7 +1300,7 @@
|
|
|
1283
1300
|
const targetOpacity = (targetEl as any).opacity ?? 1;
|
|
1284
1301
|
const presetKf = entranceRuntimeKeyframe(entrance);
|
|
1285
1302
|
if (presetKf && entrance !== 'fade' && entrance !== 'none') {
|
|
1286
|
-
|
|
1303
|
+
// Let CSS keyframe own opacity for entire entrance (no inline snap).
|
|
1287
1304
|
presenterRegisterRuntimeAnim(targetEl.id, 'entrance', presetKf, targetEl.animationConfig?.entranceDuration ?? elementDuration, order * 100 + delay);
|
|
1288
1305
|
} else if (entrance === 'fade') {
|
|
1289
1306
|
anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration / 2, easing }));
|
|
@@ -1694,7 +1711,8 @@
|
|
|
1694
1711
|
? mpPoint.angle + (mpConfig.orientationOffset ?? 0)
|
|
1695
1712
|
: null}
|
|
1696
1713
|
{@const parallax = isCinemaMode && element?.depth ? parallaxOffset(currentCamera, element.depth, worldWidth, worldHeight) : { x: 0, y: 0 }}
|
|
1697
|
-
{
|
|
1714
|
+
{@const _entranceActive = (() => { void runtimeBump; const hasReg = typeof window !== 'undefined' && !!((window as any).__animotPresenterRuntime as Map<string, { entrance?: string }> | undefined)?.get(elementId)?.entrance; return hasReg && !!getElementInSlide(currentSlide, elementId); })()}
|
|
1715
|
+
{#if element && animated && (animated.opacity.current > 0.01 || _entranceActive) && element.visible !== false && !(element.type === 'motionPath' && !(element as MotionPathElement).showInPresentation)}
|
|
1698
1716
|
<div
|
|
1699
1717
|
class="animot-element"
|
|
1700
1718
|
class:floating={hasFloat}
|