animot-presenter 0.6.5 → 0.6.6
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 +9 -0
- package/dist/cdn/animot-presenter.esm.js +5297 -5184
- package/dist/cdn/animot-presenter.min.js +9 -9
- package/dist/types.d.ts +1 -0
- package/dist/utils/freehand-draw-reveal.d.ts +19 -0
- package/dist/utils/freehand-draw-reveal.js +116 -0
- package/dist/utils/freehand.d.ts +10 -0
- package/dist/utils/freehand.js +66 -0
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import EmbedPlayer from './EmbedPlayer.svelte';
|
|
21
21
|
import { easeInOutCubic, getEasingFn, getBackgroundStyle, gradientShapeToCss, hashFraction, getFloatAnimName, getIdleAnimName, computeFloatAmp, computeFloatSpeed, entranceRuntimeKeyframe, exitRuntimeKeyframe, emphasisKeyframeName } from './engine/utils';
|
|
22
22
|
import { drawElementToPath } from './utils/freehand';
|
|
23
|
+
import { freehandDrawReveal } from './utils/freehand-draw-reveal';
|
|
23
24
|
import { makePathInterpolator, makeMorphParts, fitPathToBox, resolveElementPath, resolveElementPathParts, shapeToPath, extractCombinedPath, extractFill, type PathInterpolator, type MorphPart } from './utils/path-morph';
|
|
24
25
|
import type {
|
|
25
26
|
AnimotProject, AnimotPresenterProps, CanvasElement, CodeElement, TextElement,
|
|
@@ -2274,11 +2275,19 @@
|
|
|
2274
2275
|
{@const morphProg = dkpm ? kpmProg : pmProg}
|
|
2275
2276
|
{@const drawMorph = dkpm ?? ((dpm && pmProg > 0 && pmProg < 1) ? dpm : restingKfMorph(element))}
|
|
2276
2277
|
{@const drawPath = drawElementToPath(drawEl)}
|
|
2278
|
+
{@const drawMode = drawEl.animation?.mode ?? 'none'}
|
|
2279
|
+
{@const drawReveal = !drawMorph && (drawMode === 'draw' || drawMode === 'undraw' || drawMode === 'draw-undraw')}
|
|
2277
2280
|
<svg class="animot-draw-element" width="100%" height="100%" viewBox={drawMorph?.viewBox ?? drawPath.viewBox} preserveAspectRatio="none" style="display:block;overflow:visible;" xmlns="http://www.w3.org/2000/svg">
|
|
2278
2281
|
{#if drawMorph}
|
|
2279
2282
|
{#each (drawMorph.parts ?? [{ interp: drawMorph.interp, fromColor: drawMorph.fromColor, toColor: drawMorph.toColor }]) as part}
|
|
2280
2283
|
<path d={part.interp(Math.max(0, Math.min(1, morphProg)))} fill={(element as any).morphColor ?? part.toColor} fill-rule="evenodd" />
|
|
2281
2284
|
{/each}
|
|
2285
|
+
{:else if drawReveal}
|
|
2286
|
+
<!-- freehandDrawReveal owns `d` (rebuilds the partial outline each frame). -->
|
|
2287
|
+
<path
|
|
2288
|
+
fill={drawEl.color}
|
|
2289
|
+
use:freehandDrawReveal={{ enabled: true, mode: drawMode, duration: drawEl.animation?.duration ?? 800, el: drawEl, loop: !!drawEl.animation?.loop, reverse: drawEl.animation?.direction === 'reverse', slideDuration: currentSlide?.duration, key: `draw-${currentSlideIndex}-${drawMode}-${drawEl.animation?.duration}-${drawEl.animation?.loop}-${drawEl.animation?.direction}` }}
|
|
2290
|
+
/>
|
|
2282
2291
|
{:else}
|
|
2283
2292
|
<path d={drawPath.d} fill={drawEl.color} />
|
|
2284
2293
|
{/if}
|