@principal-ai/logo-component 0.1.8 → 0.1.10
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.
|
@@ -53,6 +53,8 @@ interface OpenTypeTextRevealProps {
|
|
|
53
53
|
fadeOpacity?: number;
|
|
54
54
|
loop?: boolean;
|
|
55
55
|
loopDelay?: number;
|
|
56
|
+
/** Delay before the animation starts (in seconds). Default: 0 */
|
|
57
|
+
animationDelay?: number;
|
|
56
58
|
}
|
|
57
59
|
export declare const OpenTypeTextReveal: React.FC<OpenTypeTextRevealProps>;
|
|
58
60
|
export {};
|
|
@@ -281,7 +281,7 @@ function samplePointsAlongPath(d, numPoints, distribution, seed) {
|
|
|
281
281
|
}
|
|
282
282
|
return points;
|
|
283
283
|
}
|
|
284
|
-
const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height = 150, centerText = true, showChartIntro, chartDuration = 1.5, chartLineFadeDuration = 0.5, chartPauseDuration = 0.3, chartTransitionDuration = 0.8, chartPattern = "latency", dotsPerPathUnit = 30, minDotsPerContour = 1, maxDotsPerContour = 0, dotDistribution = "even", chaosMode = "none", chaosDuration = 2, dotsDuration = 1.5, flowDuration = 2, flowDelay = 0.3, particlesPerPath = 1, particleRadius = 2, color = "currentColor", wordColors, particleColor, strokeWidth = 1.5, opacity = 0.9, showGlow = true, fadeAfterAssembly = true, fadeOpacity = 0.5, loop = true, loopDelay = 1, }) => {
|
|
284
|
+
const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height = 150, centerText = true, showChartIntro, chartDuration = 1.5, chartLineFadeDuration = 0.5, chartPauseDuration = 0.3, chartTransitionDuration = 0.8, chartPattern = "latency", dotsPerPathUnit = 30, minDotsPerContour = 1, maxDotsPerContour = 0, dotDistribution = "even", chaosMode = "none", chaosDuration = 2, dotsDuration = 1.5, flowDuration = 2, flowDelay = 0.3, particlesPerPath = 1, particleRadius = 2, color = "currentColor", wordColors, particleColor, strokeWidth = 1.5, opacity = 0.9, showGlow = true, fadeAfterAssembly = true, fadeOpacity = 0.5, loop = true, loopDelay = 1, animationDelay = 0, }) => {
|
|
285
285
|
const idRef = (0, react_1.useRef)(null);
|
|
286
286
|
if (idRef.current === null) {
|
|
287
287
|
idRef.current = `otr${globalIdCounter++}`;
|
|
@@ -441,10 +441,10 @@ const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height
|
|
|
441
441
|
}
|
|
442
442
|
return color;
|
|
443
443
|
};
|
|
444
|
-
// Chart intro timing
|
|
445
|
-
const chartPhaseEndTime = shouldShowChartIntro
|
|
444
|
+
// Chart intro timing (add animationDelay to offset entire sequence)
|
|
445
|
+
const chartPhaseEndTime = animationDelay + (shouldShowChartIntro
|
|
446
446
|
? chartDuration + chartLineFadeDuration + chartPauseDuration + chartTransitionDuration
|
|
447
|
-
: 0;
|
|
447
|
+
: 0);
|
|
448
448
|
// Timing calculations (offset by chart phase if present)
|
|
449
449
|
const numPaths = resolvedPaths.length || 1;
|
|
450
450
|
const perItemDotsDuration = (dotsDuration * 0.5) / numPaths;
|
|
@@ -499,15 +499,15 @@ const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height
|
|
|
499
499
|
});
|
|
500
500
|
return Array.from(positionsByWord.entries()).map(([wordIndex, positions]) => (react_1.default.createElement("polyline", { key: `chart-line-${wordIndex}`, points: positions.map(p => `${p.x},${p.y}`).join(' '), fill: "none", stroke: getWordColor(wordIndex), strokeWidth: strokeWidth * 0.75, strokeLinecap: "round", strokeLinejoin: "round", opacity: "0" },
|
|
501
501
|
react_1.default.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: "0s", fill: "freeze" }),
|
|
502
|
-
react_1.default.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${chartDuration}s`, fill: "freeze" }))));
|
|
502
|
+
react_1.default.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${animationDelay + chartDuration}s`, fill: "freeze" }))));
|
|
503
503
|
})(),
|
|
504
504
|
chartPositions.map((chartPos, index) => {
|
|
505
505
|
const targetPos = dotTargetPositions[index];
|
|
506
506
|
if (!targetPos)
|
|
507
507
|
return null;
|
|
508
508
|
const dotRadius = strokeWidth;
|
|
509
|
-
const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance
|
|
510
|
-
const transitionBegin = chartDuration + chartLineFadeDuration + chartPauseDuration;
|
|
509
|
+
const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance (no delay)
|
|
510
|
+
const transitionBegin = animationDelay + chartDuration + chartLineFadeDuration + chartPauseDuration; // Transition is delayed
|
|
511
511
|
// Fade out when this dot's contour starts drawing
|
|
512
512
|
const contourDrawBegin = dotsPhaseEnd + (targetPos.contourIndex + 1) * perItemLinesDuration;
|
|
513
513
|
const dotColor = getWordColor(chartPos.wordIndex);
|
|
@@ -242,7 +242,7 @@ function samplePointsAlongPath(d, numPoints, distribution, seed) {
|
|
|
242
242
|
}
|
|
243
243
|
return points;
|
|
244
244
|
}
|
|
245
|
-
export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height = 150, centerText = true, showChartIntro, chartDuration = 1.5, chartLineFadeDuration = 0.5, chartPauseDuration = 0.3, chartTransitionDuration = 0.8, chartPattern = "latency", dotsPerPathUnit = 30, minDotsPerContour = 1, maxDotsPerContour = 0, dotDistribution = "even", chaosMode = "none", chaosDuration = 2, dotsDuration = 1.5, flowDuration = 2, flowDelay = 0.3, particlesPerPath = 1, particleRadius = 2, color = "currentColor", wordColors, particleColor, strokeWidth = 1.5, opacity = 0.9, showGlow = true, fadeAfterAssembly = true, fadeOpacity = 0.5, loop = true, loopDelay = 1, }) => {
|
|
245
|
+
export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height = 150, centerText = true, showChartIntro, chartDuration = 1.5, chartLineFadeDuration = 0.5, chartPauseDuration = 0.3, chartTransitionDuration = 0.8, chartPattern = "latency", dotsPerPathUnit = 30, minDotsPerContour = 1, maxDotsPerContour = 0, dotDistribution = "even", chaosMode = "none", chaosDuration = 2, dotsDuration = 1.5, flowDuration = 2, flowDelay = 0.3, particlesPerPath = 1, particleRadius = 2, color = "currentColor", wordColors, particleColor, strokeWidth = 1.5, opacity = 0.9, showGlow = true, fadeAfterAssembly = true, fadeOpacity = 0.5, loop = true, loopDelay = 1, animationDelay = 0, }) => {
|
|
246
246
|
const idRef = useRef(null);
|
|
247
247
|
if (idRef.current === null) {
|
|
248
248
|
idRef.current = `otr${globalIdCounter++}`;
|
|
@@ -402,10 +402,10 @@ export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600,
|
|
|
402
402
|
}
|
|
403
403
|
return color;
|
|
404
404
|
};
|
|
405
|
-
// Chart intro timing
|
|
406
|
-
const chartPhaseEndTime = shouldShowChartIntro
|
|
405
|
+
// Chart intro timing (add animationDelay to offset entire sequence)
|
|
406
|
+
const chartPhaseEndTime = animationDelay + (shouldShowChartIntro
|
|
407
407
|
? chartDuration + chartLineFadeDuration + chartPauseDuration + chartTransitionDuration
|
|
408
|
-
: 0;
|
|
408
|
+
: 0);
|
|
409
409
|
// Timing calculations (offset by chart phase if present)
|
|
410
410
|
const numPaths = resolvedPaths.length || 1;
|
|
411
411
|
const perItemDotsDuration = (dotsDuration * 0.5) / numPaths;
|
|
@@ -460,15 +460,15 @@ export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600,
|
|
|
460
460
|
});
|
|
461
461
|
return Array.from(positionsByWord.entries()).map(([wordIndex, positions]) => (React.createElement("polyline", { key: `chart-line-${wordIndex}`, points: positions.map(p => `${p.x},${p.y}`).join(' '), fill: "none", stroke: getWordColor(wordIndex), strokeWidth: strokeWidth * 0.75, strokeLinecap: "round", strokeLinejoin: "round", opacity: "0" },
|
|
462
462
|
React.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: "0s", fill: "freeze" }),
|
|
463
|
-
React.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${chartDuration}s`, fill: "freeze" }))));
|
|
463
|
+
React.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${animationDelay + chartDuration}s`, fill: "freeze" }))));
|
|
464
464
|
})(),
|
|
465
465
|
chartPositions.map((chartPos, index) => {
|
|
466
466
|
const targetPos = dotTargetPositions[index];
|
|
467
467
|
if (!targetPos)
|
|
468
468
|
return null;
|
|
469
469
|
const dotRadius = strokeWidth;
|
|
470
|
-
const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance
|
|
471
|
-
const transitionBegin = chartDuration + chartLineFadeDuration + chartPauseDuration;
|
|
470
|
+
const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance (no delay)
|
|
471
|
+
const transitionBegin = animationDelay + chartDuration + chartLineFadeDuration + chartPauseDuration; // Transition is delayed
|
|
472
472
|
// Fade out when this dot's contour starts drawing
|
|
473
473
|
const contourDrawBegin = dotsPhaseEnd + (targetPos.contourIndex + 1) * perItemLinesDuration;
|
|
474
474
|
const dotColor = getWordColor(chartPos.wordIndex);
|