@principal-ai/logo-component 0.1.7 → 0.1.9

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;
@@ -475,8 +475,7 @@ const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height
475
475
  error)));
476
476
  }
477
477
  if (!font) {
478
- return (react_1.default.createElement("svg", { width: width, height: height },
479
- react_1.default.createElement("text", { x: 10, y: 30, fill: color, fontSize: 14 }, "Loading font...")));
478
+ return null;
480
479
  }
481
480
  return (react_1.default.createElement("svg", { key: cycle, width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
482
481
  react_1.default.createElement("defs", null,
@@ -499,16 +498,16 @@ const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600, height
499
498
  positionsByWord.get(pos.wordIndex).push({ x: pos.x, y: pos.y });
500
499
  });
501
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" },
502
- react_1.default.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: "0s", fill: "freeze" }),
503
- react_1.default.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${chartDuration}s`, fill: "freeze" }))));
501
+ react_1.default.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: `${animationDelay}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" }))));
504
503
  })(),
505
504
  chartPositions.map((chartPos, index) => {
506
505
  const targetPos = dotTargetPositions[index];
507
506
  if (!targetPos)
508
507
  return null;
509
508
  const dotRadius = strokeWidth;
510
- const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance
511
- const transitionBegin = chartDuration + chartLineFadeDuration + chartPauseDuration;
509
+ const dotAppearDelay = animationDelay + (index / chartPositions.length) * 0.5; // Stagger appearance
510
+ const transitionBegin = animationDelay + chartDuration + chartLineFadeDuration + chartPauseDuration;
512
511
  // Fade out when this dot's contour starts drawing
513
512
  const contourDrawBegin = dotsPhaseEnd + (targetPos.contourIndex + 1) * perItemLinesDuration;
514
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;
@@ -436,8 +436,7 @@ export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600,
436
436
  error)));
437
437
  }
438
438
  if (!font) {
439
- return (React.createElement("svg", { width: width, height: height },
440
- React.createElement("text", { x: 10, y: 30, fill: color, fontSize: 14 }, "Loading font...")));
439
+ return null;
441
440
  }
442
441
  return (React.createElement("svg", { key: cycle, width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
443
442
  React.createElement("defs", null,
@@ -460,16 +459,16 @@ export const OpenTypeTextReveal = ({ text, fontUrl, fontSize = 72, width = 600,
460
459
  positionsByWord.get(pos.wordIndex).push({ x: pos.x, y: pos.y });
461
460
  });
462
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" },
463
- React.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: "0s", fill: "freeze" }),
464
- React.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${chartDuration}s`, fill: "freeze" }))));
462
+ React.createElement("animate", { attributeName: "opacity", from: "0", to: "0.6", dur: "0.3s", begin: `${animationDelay}s`, fill: "freeze" }),
463
+ React.createElement("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: `${chartLineFadeDuration}s`, begin: `${animationDelay + chartDuration}s`, fill: "freeze" }))));
465
464
  })(),
466
465
  chartPositions.map((chartPos, index) => {
467
466
  const targetPos = dotTargetPositions[index];
468
467
  if (!targetPos)
469
468
  return null;
470
469
  const dotRadius = strokeWidth;
471
- const dotAppearDelay = (index / chartPositions.length) * 0.5; // Stagger appearance
472
- const transitionBegin = chartDuration + chartLineFadeDuration + chartPauseDuration;
470
+ const dotAppearDelay = animationDelay + (index / chartPositions.length) * 0.5; // Stagger appearance
471
+ const transitionBegin = animationDelay + chartDuration + chartLineFadeDuration + chartPauseDuration;
473
472
  // Fade out when this dot's contour starts drawing
474
473
  const contourDrawBegin = dotsPhaseEnd + (targetPos.contourIndex + 1) * perItemLinesDuration;
475
474
  const dotColor = getWordColor(chartPos.wordIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/logo-component",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Animated wireframe sphere logo component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",