animot-presenter 0.1.3 → 0.2.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.
@@ -1,4 +1,9 @@
1
+ export declare function easeLinear(t: number): number;
2
+ export declare function easeInCubic(t: number): number;
3
+ export declare function easeOutCubic(t: number): number;
1
4
  export declare function easeInOutCubic(t: number): number;
5
+ export declare function easeSpring(t: number): number;
6
+ export declare function getEasingFn(name?: string): (t: number) => number;
2
7
  export declare function interpolateColor(color1: string, color2: string, progress: number): string;
3
8
  export declare function hashFraction(str: string, salt?: number): number;
4
9
  export declare function getFloatAnimName(direction: string, seed: string): string;
@@ -1,6 +1,24 @@
1
+ export function easeLinear(t) { return t; }
2
+ export function easeInCubic(t) { return t * t * t; }
3
+ export function easeOutCubic(t) { return 1 - Math.pow(1 - t, 3); }
1
4
  export function easeInOutCubic(t) {
2
5
  return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
3
6
  }
7
+ export function easeSpring(t) {
8
+ const c4 = (2 * Math.PI) / 3;
9
+ return t === 0 ? 0 : t === 1 ? 1 : Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
10
+ }
11
+ export function getEasingFn(name) {
12
+ switch (name) {
13
+ case 'linear': return easeLinear;
14
+ case 'ease-in': return easeInCubic;
15
+ case 'ease-out': return easeOutCubic;
16
+ case 'spring': return easeSpring;
17
+ case 'ease': return easeOutCubic;
18
+ case 'ease-in-out':
19
+ default: return easeInOutCubic;
20
+ }
21
+ }
4
22
  export function interpolateColor(color1, color2, progress) {
5
23
  if (color1 === 'transparent')
6
24
  color1 = '#00000000';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as AnimotPresenter } from './AnimotPresenter.svelte';
2
- export type { AnimotProject, AnimotPresenterProps, Slide, SlideCanvas, CanvasElement, CanvasBackground, TransitionConfig, TransitionType, ProjectSettings, BaseElement, CodeElement, TextElement, ArrowElement, ImageElement, ShapeElement, CounterElement, ChartElement, IconElement, ElementAnimationConfig, FloatingAnimationConfig, ParticlesConfig, ConfettiConfig } from './types';
2
+ export type { AnimotProject, AnimotPresenterProps, Slide, SlideCanvas, CanvasElement, CanvasBackground, TransitionConfig, TransitionType, ProjectSettings, BaseElement, CodeElement, TextElement, ArrowElement, ImageElement, ShapeElement, CounterElement, ChartElement, IconElement, SvgElement, MotionPathElement, PathPoint, MotionPathConfig, ElementAnimationConfig, FloatingAnimationConfig, ParticlesConfig, ConfettiConfig } from './types';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type ElementType = 'code' | 'text' | 'arrow' | 'image' | 'shape' | 'counter' | 'chart' | 'icon';
1
+ export type ElementType = 'code' | 'text' | 'arrow' | 'image' | 'shape' | 'counter' | 'chart' | 'icon' | 'svg' | 'motionPath';
2
2
  export type ShapeType = 'rectangle' | 'circle' | 'triangle' | 'ellipse' | 'star' | 'hexagon';
3
3
  export interface Position {
4
4
  x: number;
@@ -9,19 +9,23 @@ export interface Size {
9
9
  height: number;
10
10
  }
11
11
  export type TiltOrigin = string;
12
- export type AnimatableProperty = 'position' | 'rotation' | 'tilt' | 'skew' | 'size' | 'opacity' | 'borderRadius' | 'color';
12
+ export type AnimatableProperty = 'position' | 'rotation' | 'tilt' | 'skew' | 'size' | 'opacity' | 'borderRadius' | 'color' | 'perspective';
13
13
  export interface PropertySequence {
14
14
  property: AnimatableProperty;
15
15
  order: number;
16
16
  delay: number;
17
17
  duration: number;
18
18
  }
19
+ export type EntranceAnimation = 'fade' | 'none';
20
+ export type ExitAnimation = 'fade' | 'none';
19
21
  export interface ElementAnimationConfig {
20
22
  order: number;
21
23
  delay: number;
22
24
  duration: number;
23
25
  easing: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring';
24
26
  propertySequences?: PropertySequence[];
27
+ entrance?: EntranceAnimation;
28
+ exit?: ExitAnimation;
25
29
  }
26
30
  export type FloatingDirection = 'vertical' | 'horizontal' | 'both';
27
31
  export interface FloatingAnimationConfig {
@@ -32,6 +36,20 @@ export interface FloatingAnimationConfig {
32
36
  amplitudeRandomness: number;
33
37
  speedRandomness: number;
34
38
  }
39
+ export interface PathPoint {
40
+ x: number;
41
+ y: number;
42
+ handleIn?: Position;
43
+ handleOut?: Position;
44
+ }
45
+ export interface MotionPathConfig {
46
+ motionPathId: string;
47
+ startPercent: number;
48
+ endPercent: number;
49
+ autoRotate: boolean;
50
+ orientationOffset: number;
51
+ loop: boolean;
52
+ }
35
53
  export interface BaseElement {
36
54
  id: string;
37
55
  type: ElementType;
@@ -48,8 +66,12 @@ export interface BaseElement {
48
66
  tiltOrigin: TiltOrigin;
49
67
  zIndex: number;
50
68
  visible: boolean;
69
+ perspective?: number;
70
+ backfaceVisibility?: 'visible' | 'hidden';
51
71
  animationConfig?: ElementAnimationConfig;
52
72
  floatingAnimation?: FloatingAnimationConfig;
73
+ motionPathId?: string;
74
+ motionPathConfig?: MotionPathConfig;
53
75
  }
54
76
  export type CodeAnimationMode = 'instant' | 'typewriter' | 'highlight-changes';
55
77
  export interface CodeAnimationConfig {
@@ -139,6 +161,7 @@ export interface ImageElement extends BaseElement {
139
161
  borderRadius: number;
140
162
  opacity: number;
141
163
  blur: number;
164
+ backgroundColor?: string;
142
165
  clipMask?: {
143
166
  enabled: boolean;
144
167
  shapeType: ShapeType;
@@ -214,7 +237,22 @@ export interface IconElement extends BaseElement {
214
237
  strokeWidth: number;
215
238
  fillMode: 'stroke' | 'fill' | 'both';
216
239
  }
217
- export type CanvasElement = CodeElement | TextElement | ArrowElement | ImageElement | ShapeElement | CounterElement | ChartElement | IconElement;
240
+ export interface SvgElement extends BaseElement {
241
+ type: 'svg';
242
+ svgContent: string;
243
+ color?: string;
244
+ opacity: number;
245
+ preserveAspectRatio: string;
246
+ }
247
+ export interface MotionPathElement extends BaseElement {
248
+ type: 'motionPath';
249
+ points: PathPoint[];
250
+ closed: boolean;
251
+ pathColor: string;
252
+ pathWidth: number;
253
+ showInPresentation: boolean;
254
+ }
255
+ export type CanvasElement = CodeElement | TextElement | ArrowElement | ImageElement | ShapeElement | CounterElement | ChartElement | IconElement | SvgElement | MotionPathElement;
218
256
  export type ParticleShape = 'circle' | 'square' | 'star' | 'triangle';
219
257
  export interface ParticlesConfig {
220
258
  enabled: boolean;
@@ -252,7 +290,7 @@ export interface CanvasBackground {
252
290
  particles?: ParticlesConfig;
253
291
  confetti?: ConfettiConfig;
254
292
  }
255
- export type TransitionType = 'none' | 'fade' | 'slide-left' | 'slide-right' | 'slide-up' | 'slide-down' | 'zoom-in' | 'zoom-out' | 'flip';
293
+ export type TransitionType = 'none' | 'fade' | 'slide-left' | 'slide-right' | 'slide-up' | 'slide-down' | 'zoom-in' | 'zoom-out' | 'flip' | 'flip-x' | 'flip-y';
256
294
  export interface TransitionConfig {
257
295
  type: TransitionType;
258
296
  duration: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "animot-presenter",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Embed animated presentations anywhere. Works with vanilla JS, React, Vue, Angular, Svelte, and any frontend framework. Morphing animations, code highlighting, charts, particles, and more.",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",