@shotstack/shotstack-canvas 2.1.3 → 2.1.4
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/entry.node.cjs +38 -16
- package/dist/entry.node.js +38 -16
- package/dist/entry.web.js +38 -16
- package/package.json +1 -1
package/dist/entry.node.cjs
CHANGED
|
@@ -2727,7 +2727,8 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
2727
2727
|
return {
|
|
2728
2728
|
scale: 0.5,
|
|
2729
2729
|
opacity: 0,
|
|
2730
|
-
isActive: false
|
|
2730
|
+
isActive: false,
|
|
2731
|
+
fillProgress: 0
|
|
2731
2732
|
};
|
|
2732
2733
|
}
|
|
2733
2734
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -2735,28 +2736,33 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
2735
2736
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2736
2737
|
const easedProgress = easeOutBack(progress);
|
|
2737
2738
|
const startScale = 0.5;
|
|
2738
|
-
const
|
|
2739
|
+
const isActive = isWordActive(ctx);
|
|
2740
|
+
const endScale = isActive ? activeScale : 1;
|
|
2739
2741
|
const scale = startScale + (endScale - startScale) * easedProgress;
|
|
2740
2742
|
return {
|
|
2741
2743
|
scale: Math.min(scale, activeScale),
|
|
2742
2744
|
opacity: easedProgress,
|
|
2743
|
-
isActive
|
|
2745
|
+
isActive,
|
|
2746
|
+
fillProgress: isActive ? 1 : 0
|
|
2744
2747
|
};
|
|
2745
2748
|
}
|
|
2746
2749
|
function calculateFadeState(ctx, speed) {
|
|
2747
2750
|
if (ctx.currentTime < ctx.wordStart) {
|
|
2748
2751
|
return {
|
|
2749
2752
|
opacity: 0,
|
|
2750
|
-
isActive: false
|
|
2753
|
+
isActive: false,
|
|
2754
|
+
fillProgress: 0
|
|
2751
2755
|
};
|
|
2752
2756
|
}
|
|
2753
2757
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
2754
2758
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
2755
2759
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2756
2760
|
const easedProgress = easeInOutQuad(progress);
|
|
2761
|
+
const isActive = isWordActive(ctx);
|
|
2757
2762
|
return {
|
|
2758
2763
|
opacity: easedProgress,
|
|
2759
|
-
isActive
|
|
2764
|
+
isActive,
|
|
2765
|
+
fillProgress: isActive ? 1 : 0
|
|
2760
2766
|
};
|
|
2761
2767
|
}
|
|
2762
2768
|
function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
@@ -2767,7 +2773,8 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
2767
2773
|
translateX: offset2.x,
|
|
2768
2774
|
translateY: offset2.y,
|
|
2769
2775
|
opacity: 0,
|
|
2770
|
-
isActive: false
|
|
2776
|
+
isActive: false,
|
|
2777
|
+
fillProgress: 0
|
|
2771
2778
|
};
|
|
2772
2779
|
}
|
|
2773
2780
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -2777,11 +2784,13 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
2777
2784
|
const offset = getDirectionOffset(direction, slideDistance);
|
|
2778
2785
|
const translateX = offset.x * (1 - easedProgress);
|
|
2779
2786
|
const translateY = offset.y * (1 - easedProgress);
|
|
2787
|
+
const isActive = isWordActive(ctx);
|
|
2780
2788
|
return {
|
|
2781
2789
|
translateX,
|
|
2782
2790
|
translateY,
|
|
2783
2791
|
opacity: easeOutQuad2(progress),
|
|
2784
|
-
isActive
|
|
2792
|
+
isActive,
|
|
2793
|
+
fillProgress: isActive ? 1 : 0
|
|
2785
2794
|
};
|
|
2786
2795
|
}
|
|
2787
2796
|
function getDirectionOffset(direction, distance) {
|
|
@@ -2802,17 +2811,20 @@ function calculateBounceState(ctx, speed, fontSize) {
|
|
|
2802
2811
|
return {
|
|
2803
2812
|
translateY: -bounceDistance,
|
|
2804
2813
|
opacity: 0,
|
|
2805
|
-
isActive: false
|
|
2814
|
+
isActive: false,
|
|
2815
|
+
fillProgress: 0
|
|
2806
2816
|
};
|
|
2807
2817
|
}
|
|
2808
2818
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
2809
2819
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
2810
2820
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2811
2821
|
const easedProgress = easeOutBounce(progress);
|
|
2822
|
+
const isActive = isWordActive(ctx);
|
|
2812
2823
|
return {
|
|
2813
2824
|
translateY: -bounceDistance * (1 - easedProgress),
|
|
2814
2825
|
opacity: easeOutQuad2(progress),
|
|
2815
|
-
isActive
|
|
2826
|
+
isActive,
|
|
2827
|
+
fillProgress: isActive ? 1 : 0
|
|
2816
2828
|
};
|
|
2817
2829
|
}
|
|
2818
2830
|
function calculateTypewriterState(ctx, charCount, speed) {
|
|
@@ -2928,20 +2940,30 @@ var WORD_BG_PADDING_RATIO = 0.12;
|
|
|
2928
2940
|
function extractFontConfig(asset) {
|
|
2929
2941
|
const font = asset.font;
|
|
2930
2942
|
const active = asset.active?.font;
|
|
2943
|
+
const hasActiveConfig = asset.active !== void 0;
|
|
2931
2944
|
const baseColor = font?.color ?? "#ffffff";
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2945
|
+
const baseOpacity = font?.opacity ?? 1;
|
|
2946
|
+
let activeColor;
|
|
2947
|
+
let activeOpacity;
|
|
2948
|
+
if (!hasActiveConfig) {
|
|
2949
|
+
activeColor = baseColor;
|
|
2950
|
+
activeOpacity = baseOpacity;
|
|
2951
|
+
} else {
|
|
2952
|
+
const explicitActiveColor = active?.color;
|
|
2953
|
+
const animStyle = asset.wordAnimation?.style ?? "highlight";
|
|
2954
|
+
const isFillAnimation = animStyle === "karaoke" || animStyle === "highlight";
|
|
2955
|
+
const DEFAULT_ACTIVE_COLOR = "#ffff00";
|
|
2956
|
+
activeColor = explicitActiveColor ?? (isFillAnimation ? DEFAULT_ACTIVE_COLOR : baseColor);
|
|
2957
|
+
activeOpacity = active?.opacity ?? baseOpacity;
|
|
2958
|
+
}
|
|
2937
2959
|
return {
|
|
2938
2960
|
family: font?.family ?? "Roboto",
|
|
2939
2961
|
size: font?.size ?? 24,
|
|
2940
2962
|
weight: String(font?.weight ?? "400"),
|
|
2941
2963
|
baseColor,
|
|
2942
2964
|
activeColor,
|
|
2943
|
-
baseOpacity
|
|
2944
|
-
activeOpacity
|
|
2965
|
+
baseOpacity,
|
|
2966
|
+
activeOpacity,
|
|
2945
2967
|
letterSpacing: asset.style?.letterSpacing ?? 0
|
|
2946
2968
|
};
|
|
2947
2969
|
}
|
package/dist/entry.node.js
CHANGED
|
@@ -2324,7 +2324,8 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
2324
2324
|
return {
|
|
2325
2325
|
scale: 0.5,
|
|
2326
2326
|
opacity: 0,
|
|
2327
|
-
isActive: false
|
|
2327
|
+
isActive: false,
|
|
2328
|
+
fillProgress: 0
|
|
2328
2329
|
};
|
|
2329
2330
|
}
|
|
2330
2331
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -2332,28 +2333,33 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
2332
2333
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2333
2334
|
const easedProgress = easeOutBack(progress);
|
|
2334
2335
|
const startScale = 0.5;
|
|
2335
|
-
const
|
|
2336
|
+
const isActive = isWordActive(ctx);
|
|
2337
|
+
const endScale = isActive ? activeScale : 1;
|
|
2336
2338
|
const scale = startScale + (endScale - startScale) * easedProgress;
|
|
2337
2339
|
return {
|
|
2338
2340
|
scale: Math.min(scale, activeScale),
|
|
2339
2341
|
opacity: easedProgress,
|
|
2340
|
-
isActive
|
|
2342
|
+
isActive,
|
|
2343
|
+
fillProgress: isActive ? 1 : 0
|
|
2341
2344
|
};
|
|
2342
2345
|
}
|
|
2343
2346
|
function calculateFadeState(ctx, speed) {
|
|
2344
2347
|
if (ctx.currentTime < ctx.wordStart) {
|
|
2345
2348
|
return {
|
|
2346
2349
|
opacity: 0,
|
|
2347
|
-
isActive: false
|
|
2350
|
+
isActive: false,
|
|
2351
|
+
fillProgress: 0
|
|
2348
2352
|
};
|
|
2349
2353
|
}
|
|
2350
2354
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
2351
2355
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
2352
2356
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2353
2357
|
const easedProgress = easeInOutQuad(progress);
|
|
2358
|
+
const isActive = isWordActive(ctx);
|
|
2354
2359
|
return {
|
|
2355
2360
|
opacity: easedProgress,
|
|
2356
|
-
isActive
|
|
2361
|
+
isActive,
|
|
2362
|
+
fillProgress: isActive ? 1 : 0
|
|
2357
2363
|
};
|
|
2358
2364
|
}
|
|
2359
2365
|
function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
@@ -2364,7 +2370,8 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
2364
2370
|
translateX: offset2.x,
|
|
2365
2371
|
translateY: offset2.y,
|
|
2366
2372
|
opacity: 0,
|
|
2367
|
-
isActive: false
|
|
2373
|
+
isActive: false,
|
|
2374
|
+
fillProgress: 0
|
|
2368
2375
|
};
|
|
2369
2376
|
}
|
|
2370
2377
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -2374,11 +2381,13 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
2374
2381
|
const offset = getDirectionOffset(direction, slideDistance);
|
|
2375
2382
|
const translateX = offset.x * (1 - easedProgress);
|
|
2376
2383
|
const translateY = offset.y * (1 - easedProgress);
|
|
2384
|
+
const isActive = isWordActive(ctx);
|
|
2377
2385
|
return {
|
|
2378
2386
|
translateX,
|
|
2379
2387
|
translateY,
|
|
2380
2388
|
opacity: easeOutQuad2(progress),
|
|
2381
|
-
isActive
|
|
2389
|
+
isActive,
|
|
2390
|
+
fillProgress: isActive ? 1 : 0
|
|
2382
2391
|
};
|
|
2383
2392
|
}
|
|
2384
2393
|
function getDirectionOffset(direction, distance) {
|
|
@@ -2399,17 +2408,20 @@ function calculateBounceState(ctx, speed, fontSize) {
|
|
|
2399
2408
|
return {
|
|
2400
2409
|
translateY: -bounceDistance,
|
|
2401
2410
|
opacity: 0,
|
|
2402
|
-
isActive: false
|
|
2411
|
+
isActive: false,
|
|
2412
|
+
fillProgress: 0
|
|
2403
2413
|
};
|
|
2404
2414
|
}
|
|
2405
2415
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
2406
2416
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
2407
2417
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
2408
2418
|
const easedProgress = easeOutBounce(progress);
|
|
2419
|
+
const isActive = isWordActive(ctx);
|
|
2409
2420
|
return {
|
|
2410
2421
|
translateY: -bounceDistance * (1 - easedProgress),
|
|
2411
2422
|
opacity: easeOutQuad2(progress),
|
|
2412
|
-
isActive
|
|
2423
|
+
isActive,
|
|
2424
|
+
fillProgress: isActive ? 1 : 0
|
|
2413
2425
|
};
|
|
2414
2426
|
}
|
|
2415
2427
|
function calculateTypewriterState(ctx, charCount, speed) {
|
|
@@ -2525,20 +2537,30 @@ var WORD_BG_PADDING_RATIO = 0.12;
|
|
|
2525
2537
|
function extractFontConfig(asset) {
|
|
2526
2538
|
const font = asset.font;
|
|
2527
2539
|
const active = asset.active?.font;
|
|
2540
|
+
const hasActiveConfig = asset.active !== void 0;
|
|
2528
2541
|
const baseColor = font?.color ?? "#ffffff";
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2542
|
+
const baseOpacity = font?.opacity ?? 1;
|
|
2543
|
+
let activeColor;
|
|
2544
|
+
let activeOpacity;
|
|
2545
|
+
if (!hasActiveConfig) {
|
|
2546
|
+
activeColor = baseColor;
|
|
2547
|
+
activeOpacity = baseOpacity;
|
|
2548
|
+
} else {
|
|
2549
|
+
const explicitActiveColor = active?.color;
|
|
2550
|
+
const animStyle = asset.wordAnimation?.style ?? "highlight";
|
|
2551
|
+
const isFillAnimation = animStyle === "karaoke" || animStyle === "highlight";
|
|
2552
|
+
const DEFAULT_ACTIVE_COLOR = "#ffff00";
|
|
2553
|
+
activeColor = explicitActiveColor ?? (isFillAnimation ? DEFAULT_ACTIVE_COLOR : baseColor);
|
|
2554
|
+
activeOpacity = active?.opacity ?? baseOpacity;
|
|
2555
|
+
}
|
|
2534
2556
|
return {
|
|
2535
2557
|
family: font?.family ?? "Roboto",
|
|
2536
2558
|
size: font?.size ?? 24,
|
|
2537
2559
|
weight: String(font?.weight ?? "400"),
|
|
2538
2560
|
baseColor,
|
|
2539
2561
|
activeColor,
|
|
2540
|
-
baseOpacity
|
|
2541
|
-
activeOpacity
|
|
2562
|
+
baseOpacity,
|
|
2563
|
+
activeOpacity,
|
|
2542
2564
|
letterSpacing: asset.style?.letterSpacing ?? 0
|
|
2543
2565
|
};
|
|
2544
2566
|
}
|
package/dist/entry.web.js
CHANGED
|
@@ -34359,7 +34359,8 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
34359
34359
|
return {
|
|
34360
34360
|
scale: 0.5,
|
|
34361
34361
|
opacity: 0,
|
|
34362
|
-
isActive: false
|
|
34362
|
+
isActive: false,
|
|
34363
|
+
fillProgress: 0
|
|
34363
34364
|
};
|
|
34364
34365
|
}
|
|
34365
34366
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -34367,28 +34368,33 @@ function calculatePopState(ctx, activeScale, speed) {
|
|
|
34367
34368
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
34368
34369
|
const easedProgress = easeOutBack(progress);
|
|
34369
34370
|
const startScale = 0.5;
|
|
34370
|
-
const
|
|
34371
|
+
const isActive = isWordActive(ctx);
|
|
34372
|
+
const endScale = isActive ? activeScale : 1;
|
|
34371
34373
|
const scale = startScale + (endScale - startScale) * easedProgress;
|
|
34372
34374
|
return {
|
|
34373
34375
|
scale: Math.min(scale, activeScale),
|
|
34374
34376
|
opacity: easedProgress,
|
|
34375
|
-
isActive
|
|
34377
|
+
isActive,
|
|
34378
|
+
fillProgress: isActive ? 1 : 0
|
|
34376
34379
|
};
|
|
34377
34380
|
}
|
|
34378
34381
|
function calculateFadeState(ctx, speed) {
|
|
34379
34382
|
if (ctx.currentTime < ctx.wordStart) {
|
|
34380
34383
|
return {
|
|
34381
34384
|
opacity: 0,
|
|
34382
|
-
isActive: false
|
|
34385
|
+
isActive: false,
|
|
34386
|
+
fillProgress: 0
|
|
34383
34387
|
};
|
|
34384
34388
|
}
|
|
34385
34389
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
34386
34390
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
34387
34391
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
34388
34392
|
const easedProgress = easeInOutQuad(progress);
|
|
34393
|
+
const isActive = isWordActive(ctx);
|
|
34389
34394
|
return {
|
|
34390
34395
|
opacity: easedProgress,
|
|
34391
|
-
isActive
|
|
34396
|
+
isActive,
|
|
34397
|
+
fillProgress: isActive ? 1 : 0
|
|
34392
34398
|
};
|
|
34393
34399
|
}
|
|
34394
34400
|
function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
@@ -34399,7 +34405,8 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
34399
34405
|
translateX: offset2.x,
|
|
34400
34406
|
translateY: offset2.y,
|
|
34401
34407
|
opacity: 0,
|
|
34402
|
-
isActive: false
|
|
34408
|
+
isActive: false,
|
|
34409
|
+
fillProgress: 0
|
|
34403
34410
|
};
|
|
34404
34411
|
}
|
|
34405
34412
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
@@ -34409,11 +34416,13 @@ function calculateSlideState(ctx, direction, speed, fontSize) {
|
|
|
34409
34416
|
const offset = getDirectionOffset(direction, slideDistance);
|
|
34410
34417
|
const translateX = offset.x * (1 - easedProgress);
|
|
34411
34418
|
const translateY = offset.y * (1 - easedProgress);
|
|
34419
|
+
const isActive = isWordActive(ctx);
|
|
34412
34420
|
return {
|
|
34413
34421
|
translateX,
|
|
34414
34422
|
translateY,
|
|
34415
34423
|
opacity: easeOutQuad2(progress),
|
|
34416
|
-
isActive
|
|
34424
|
+
isActive,
|
|
34425
|
+
fillProgress: isActive ? 1 : 0
|
|
34417
34426
|
};
|
|
34418
34427
|
}
|
|
34419
34428
|
function getDirectionOffset(direction, distance) {
|
|
@@ -34434,17 +34443,20 @@ function calculateBounceState(ctx, speed, fontSize) {
|
|
|
34434
34443
|
return {
|
|
34435
34444
|
translateY: -bounceDistance,
|
|
34436
34445
|
opacity: 0,
|
|
34437
|
-
isActive: false
|
|
34446
|
+
isActive: false,
|
|
34447
|
+
fillProgress: 0
|
|
34438
34448
|
};
|
|
34439
34449
|
}
|
|
34440
34450
|
const adjustedDuration = ctx.animationDuration / speed;
|
|
34441
34451
|
const adjustedCtx = { ...ctx, animationDuration: adjustedDuration };
|
|
34442
34452
|
const progress = calculateAnimationProgress(adjustedCtx);
|
|
34443
34453
|
const easedProgress = easeOutBounce(progress);
|
|
34454
|
+
const isActive = isWordActive(ctx);
|
|
34444
34455
|
return {
|
|
34445
34456
|
translateY: -bounceDistance * (1 - easedProgress),
|
|
34446
34457
|
opacity: easeOutQuad2(progress),
|
|
34447
|
-
isActive
|
|
34458
|
+
isActive,
|
|
34459
|
+
fillProgress: isActive ? 1 : 0
|
|
34448
34460
|
};
|
|
34449
34461
|
}
|
|
34450
34462
|
function calculateTypewriterState(ctx, charCount, speed) {
|
|
@@ -34560,20 +34572,30 @@ var WORD_BG_PADDING_RATIO = 0.12;
|
|
|
34560
34572
|
function extractFontConfig(asset) {
|
|
34561
34573
|
const font = asset.font;
|
|
34562
34574
|
const active = asset.active?.font;
|
|
34575
|
+
const hasActiveConfig = asset.active !== void 0;
|
|
34563
34576
|
const baseColor = font?.color ?? "#ffffff";
|
|
34564
|
-
const
|
|
34565
|
-
|
|
34566
|
-
|
|
34567
|
-
|
|
34568
|
-
|
|
34577
|
+
const baseOpacity = font?.opacity ?? 1;
|
|
34578
|
+
let activeColor;
|
|
34579
|
+
let activeOpacity;
|
|
34580
|
+
if (!hasActiveConfig) {
|
|
34581
|
+
activeColor = baseColor;
|
|
34582
|
+
activeOpacity = baseOpacity;
|
|
34583
|
+
} else {
|
|
34584
|
+
const explicitActiveColor = active?.color;
|
|
34585
|
+
const animStyle = asset.wordAnimation?.style ?? "highlight";
|
|
34586
|
+
const isFillAnimation = animStyle === "karaoke" || animStyle === "highlight";
|
|
34587
|
+
const DEFAULT_ACTIVE_COLOR = "#ffff00";
|
|
34588
|
+
activeColor = explicitActiveColor ?? (isFillAnimation ? DEFAULT_ACTIVE_COLOR : baseColor);
|
|
34589
|
+
activeOpacity = active?.opacity ?? baseOpacity;
|
|
34590
|
+
}
|
|
34569
34591
|
return {
|
|
34570
34592
|
family: font?.family ?? "Roboto",
|
|
34571
34593
|
size: font?.size ?? 24,
|
|
34572
34594
|
weight: String(font?.weight ?? "400"),
|
|
34573
34595
|
baseColor,
|
|
34574
34596
|
activeColor,
|
|
34575
|
-
baseOpacity
|
|
34576
|
-
activeOpacity
|
|
34597
|
+
baseOpacity,
|
|
34598
|
+
activeOpacity,
|
|
34577
34599
|
letterSpacing: asset.style?.letterSpacing ?? 0
|
|
34578
34600
|
};
|
|
34579
34601
|
}
|
package/package.json
CHANGED