animot-presenter 0.6.0 → 0.6.1

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.
@@ -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
  }
@@ -1163,7 +1171,9 @@
1163
1171
  if (!sequencedProps.has('perspective')) anims.push(animated.perspective.to(targetEl.perspective ?? 1000, { duration: elementDuration, easing }));
1164
1172
  if (!sequencedProps.has('opacity')) {
1165
1173
  const targetOpacity = (targetEl as any).opacity ?? 1;
1166
- if (animated.opacity.current !== targetOpacity) anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration, easing }));
1174
+ const entrPreset = (targetEl as any).animationConfig?.entrance;
1175
+ const hasPresetEntrance = entrPreset && entrPreset !== 'fade' && entrPreset !== 'none';
1176
+ if (!hasPresetEntrance && animated.opacity.current !== targetOpacity) anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration, easing }));
1167
1177
  }
1168
1178
  const sortedSeqs = [...propertySequences].sort((a, b) => a.order - b.order);
1169
1179
  let cumulativeDelay = 0;
@@ -1213,10 +1223,13 @@
1213
1223
  anims.push(animated.contrast.to(targetEl.contrast ?? 100, { duration: elementDuration, easing }));
1214
1224
  anims.push(animated.saturate.to(targetEl.saturate ?? 100, { duration: elementDuration, easing }));
1215
1225
  anims.push(animated.grayscale.to(targetEl.grayscale ?? 0, { duration: elementDuration, easing }));
1216
- // Opacity interpolation for morphing elements
1226
+ // Opacity. Skip when a preset entrance is configured so the
1227
+ // CSS keyframe owns opacity for the entire entrance.
1228
+ const entrPreset = (targetEl as any).animationConfig?.entrance;
1229
+ const hasPresetEntrance = entrPreset && entrPreset !== 'fade' && entrPreset !== 'none';
1217
1230
  const currOpacity = animated.opacity.current;
1218
1231
  const targetOpacity = (targetEl as any).opacity ?? 1;
1219
- if (currOpacity !== targetOpacity) {
1232
+ if (!hasPresetEntrance && currOpacity !== targetOpacity) {
1220
1233
  anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration, easing }));
1221
1234
  }
1222
1235
  }
@@ -1283,7 +1296,7 @@
1283
1296
  const targetOpacity = (targetEl as any).opacity ?? 1;
1284
1297
  const presetKf = entranceRuntimeKeyframe(entrance);
1285
1298
  if (presetKf && entrance !== 'fade' && entrance !== 'none') {
1286
- anims.push(animated.opacity.to(targetOpacity, { duration: 0 }));
1299
+ // Let CSS keyframe own opacity for entire entrance (no inline snap).
1287
1300
  presenterRegisterRuntimeAnim(targetEl.id, 'entrance', presetKf, targetEl.animationConfig?.entranceDuration ?? elementDuration, order * 100 + delay);
1288
1301
  } else if (entrance === 'fade') {
1289
1302
  anims.push(animated.opacity.to(targetOpacity, { duration: elementDuration / 2, easing }));
@@ -1694,7 +1707,8 @@
1694
1707
  ? mpPoint.angle + (mpConfig.orientationOffset ?? 0)
1695
1708
  : null}
1696
1709
  {@const parallax = isCinemaMode && element?.depth ? parallaxOffset(currentCamera, element.depth, worldWidth, worldHeight) : { x: 0, y: 0 }}
1697
- {#if element && animated && animated.opacity.current > 0.01 && element.visible !== false && !(element.type === 'motionPath' && !(element as MotionPathElement).showInPresentation)}
1710
+ {@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); })()}
1711
+ {#if element && animated && (animated.opacity.current > 0.01 || _entranceActive) && element.visible !== false && !(element.type === 'motionPath' && !(element as MotionPathElement).showInPresentation)}
1698
1712
  <div
1699
1713
  class="animot-element"
1700
1714
  class:floating={hasFloat}