@real-music-packages/web-core 0.32.0 → 0.33.0

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.
@@ -1990,6 +1990,14 @@ interface EndCardProps {
1990
1990
  declare const endCardFactory: LayerFactory<EndCardProps>;
1991
1991
 
1992
1992
  type ImageRevealMode = 'pixelate' | 'shuffle' | 'blur';
1993
+ /**
1994
+ * Reveal pacing curve applied to linear progress before it drives the effect.
1995
+ * - 'linear' : constant rate (default — unchanged behavior).
1996
+ * - 'easeOut' : fast at first, SLOWER near the end (quadratic).
1997
+ * - 'easeOutStrong' : like easeOut but a more DRAMATIC, drawn-out final reveal (cubic).
1998
+ * - 'easeInOut' : slow start (stays obscured), then a slow settle at the end.
1999
+ */
2000
+ type RevealEasing = 'linear' | 'easeOut' | 'easeOutStrong' | 'easeInOut';
1993
2001
  interface ImageRevealProps {
1994
2002
  /** The image to reveal. Any CanvasImageSource (HTMLImageElement, OffscreenCanvas, …). */
1995
2003
  image: CanvasImageSource;
@@ -2006,7 +2014,9 @@ interface ImageRevealProps {
2006
2014
  * - blur: controls maximum blur radius in px (0→mild, 1→extreme; default 0.5 ≈ 40px).
2007
2015
  */
2008
2016
  difficulty?: number;
2017
+ /** Pacing curve for the reveal. Default 'linear'. See RevealEasing. */
2018
+ easing?: RevealEasing;
2009
2019
  }
2010
2020
  declare const imageRevealFactory: LayerFactory<ImageRevealProps>;
2011
2021
 
2012
- export { type Affine, type AudioClock, type AudioEvent, type BackgroundProps, type BeatGridOpts, type BeatPulseProps, type BeatTick, type BrandingProps, type BufferFactory, type BuildSceneOpts, type BuiltScene, type CameraState, type CaptionCue, type CaptionProps, type CaptionScript, type CaptionStyle, type ChordRibbonProps, type ChordSpan, type CircleOfFifthsProps, type CirclePoint, type ClickTrackOpts, type ColorBy, type ContourPlot, type ContourPoint, type CountInOpts, type CountdownProps, type CountingTrackProps, type CtaProps, DEFAULT_FUNCTION_COLORS, type DegreeLabel, type DegreeLabelsProps, type DroneOpts, type DuckWindow, type Easing, type EndCardProps, type ExtendedDemoOpts, FIFTHS_MAJOR, FIFTHS_MINOR, FOLLOW_BARS, FOLLOW_PAD, type FallingKeyboardDemoOpts, type FallingNotesProps, type FretboardProps, type FunctionColors, type FunctionalHarmonyProps, type GateError, type GateInput, type HandColors, type HarmonicFunction, type HarmonyMode, type HighlightRegion, type HookProps, type ImageRevealMode, type ImageRevealProps, type IntervalArcsProps, type KaraokeCaptionProps, type KaraokeWord, type KeyRect, type KeyboardLayout, type KeyboardLayoutOpts, type KeyboardProps, type KineticMode, type KineticTextProps, type LabelMode, type Layer, type LayerFactory, type McqCardProps, type NotationEngraving, type NotationLayout, type NotationLayoutOpts, type NotationProps, type NotationRect, type OutputProbe, PIANO_HIGH, PIANO_LOW, type ParticleBurstProps, type PitchContourProps, type Placement, type PlayheadLine, type PortraitProps, type ProgressRingProps, type PromoCardsDemoOpts, type PulseStyle, type Quiz, type QuizOption, type QuizPhase, type RadialSpectrumProps, type RayEndpoints, type RecordSceneSpecOpts, type Rect, type RenderCtx, type ResolvedSegment, type RevealProps, SCALE_INTERVALS, type SafeGuidesProps, type ScaleHighlightProps, type SceneSpec, type ScheduleTarget, type Score, type ScoreFromMusicXMLOpts, type ScoreNote, type ScrollCursorProps, type Section, type SectionMinimapProps, type SegmentAudio, type SegmentAudioCtx, type SegmentTransition, type SpecLayer, type SpectrumInput, type SpectrumProps, type StaffKeyboardRayProps, type StatCounterProps, type TempoMap, type TensionGraphProps, type TensionPoint, type TextureProps, type TimeAnchor, type TimelineSegment, type WaveformInput, type WaveformProps, activeChord, activeCue, activeSection, animatedSlot, applySchedule, applyToContext, assertGate, audioPlayheadLine, ballArc, ballX, beatGrid, beatPhase, beatPulseFactory, blackKeys, bpmOf, brandingFactory, buildScene, cameraForFollow, cameraTransform, chordRibbonFactory, circleOfFifthsDemoSpec, circleOfFifthsFactory, clamp, clickTrackSchedule, contourMinimapDemoSpec, contourPoints, contourPolyline, countInLeadSec, countInSchedule, countdownFactory, countdownRemaining, countdownSeconds, countingDegreeDemoSpec, countingTrackFactory, cropAroundBox, ctaFactory, cubicEaseInOut, cueOpacity, degreeLabel, degreeLabelsFactory, distinctMeasureIndices, distinctOnsets, dotAt, drawCaption, drawHighlight, droneSchedule, duckGainAt, easeIn, easeInOut, easeOut, endCardFactory, fallingKeyboardDemoScore, fallingKeyboardDemoSpec, fallingNotesFactory, firstMeasureBox, followBoxAt, followSrcBox, followWindowStart, fracSlotPoint, frameRect, fretboardFactory, functionColor, functionalHarmonyFactory, getKeyboardLayout, getLayerFactory, getNotationEngraving, harmonyDemoSpec, highlightIntensity, hookFactory, identityCamera, imageRevealFactory, inRange, intervalArcsFactory, invLerp, isBlackKey, karaokeCaptionFactory, kenBurns, keyCenterX, keyColumnWidth, keyRect, keySlot, keyboardFactory, keyboardLayout, kineticTextFactory, lerp, lerpBox, lerpCamera, linear, mapBoxThroughLayout, mcqCardFactory, mcqDemoSpec, measureColumnsFromLayout, measureCount, measureSpanBox, measureSpans, measureSystemMap, timeToX as minimapTimeToX, msPerBeat, notationFactory, notationLayout, noteColor, noteSetXRange, parseKey, parseTimeSig, particleBurstFactory, pcToSlot, pitchAt, pitchContourFactory, pitchRange, playheadLine, portraitFactory, progress01, progressRingFactory, projectPoint, promoCardsDemoSpec, pulseAt, quizPhase, radialSpectrumFactory, rayEndpoints, rayPointAt, recordSceneSpec, registerLayer, registeredKeys, resolveAnchor, resolveKeyboardLayout, resolveTimeline, revealFactory, revealProgress, runGate, safeGuidesFactory, scaleHighlightFactory, scoreFromMusicXML, scorePitchSpan, scrollCursorFactory, sectionMinimapFactory, setFollowLayoutProvider, setKeyboardLayout, setNotationEngraving, slotAngle, slotPc, slotPoint, spectrumFactory, staffAnchor, staffKeyboardRayFactory, staffRayDemoSpec, statCounterFactory, systemBox, tensionGraphFactory, textureFactory, transitionProgress, validateChordTrack, validateQuiz, validateSections, visualTimelineMs, vstackAudioPlayheadLine, vstackFollowBox, waveformFactory, whiteKeys, worldToViewport };
2022
+ export { type Affine, type AudioClock, type AudioEvent, type BackgroundProps, type BeatGridOpts, type BeatPulseProps, type BeatTick, type BrandingProps, type BufferFactory, type BuildSceneOpts, type BuiltScene, type CameraState, type CaptionCue, type CaptionProps, type CaptionScript, type CaptionStyle, type ChordRibbonProps, type ChordSpan, type CircleOfFifthsProps, type CirclePoint, type ClickTrackOpts, type ColorBy, type ContourPlot, type ContourPoint, type CountInOpts, type CountdownProps, type CountingTrackProps, type CtaProps, DEFAULT_FUNCTION_COLORS, type DegreeLabel, type DegreeLabelsProps, type DroneOpts, type DuckWindow, type Easing, type EndCardProps, type ExtendedDemoOpts, FIFTHS_MAJOR, FIFTHS_MINOR, FOLLOW_BARS, FOLLOW_PAD, type FallingKeyboardDemoOpts, type FallingNotesProps, type FretboardProps, type FunctionColors, type FunctionalHarmonyProps, type GateError, type GateInput, type HandColors, type HarmonicFunction, type HarmonyMode, type HighlightRegion, type HookProps, type ImageRevealMode, type ImageRevealProps, type IntervalArcsProps, type KaraokeCaptionProps, type KaraokeWord, type KeyRect, type KeyboardLayout, type KeyboardLayoutOpts, type KeyboardProps, type KineticMode, type KineticTextProps, type LabelMode, type Layer, type LayerFactory, type McqCardProps, type NotationEngraving, type NotationLayout, type NotationLayoutOpts, type NotationProps, type NotationRect, type OutputProbe, PIANO_HIGH, PIANO_LOW, type ParticleBurstProps, type PitchContourProps, type Placement, type PlayheadLine, type PortraitProps, type ProgressRingProps, type PromoCardsDemoOpts, type PulseStyle, type Quiz, type QuizOption, type QuizPhase, type RadialSpectrumProps, type RayEndpoints, type RecordSceneSpecOpts, type Rect, type RenderCtx, type ResolvedSegment, type RevealEasing, type RevealProps, SCALE_INTERVALS, type SafeGuidesProps, type ScaleHighlightProps, type SceneSpec, type ScheduleTarget, type Score, type ScoreFromMusicXMLOpts, type ScoreNote, type ScrollCursorProps, type Section, type SectionMinimapProps, type SegmentAudio, type SegmentAudioCtx, type SegmentTransition, type SpecLayer, type SpectrumInput, type SpectrumProps, type StaffKeyboardRayProps, type StatCounterProps, type TempoMap, type TensionGraphProps, type TensionPoint, type TextureProps, type TimeAnchor, type TimelineSegment, type WaveformInput, type WaveformProps, activeChord, activeCue, activeSection, animatedSlot, applySchedule, applyToContext, assertGate, audioPlayheadLine, ballArc, ballX, beatGrid, beatPhase, beatPulseFactory, blackKeys, bpmOf, brandingFactory, buildScene, cameraForFollow, cameraTransform, chordRibbonFactory, circleOfFifthsDemoSpec, circleOfFifthsFactory, clamp, clickTrackSchedule, contourMinimapDemoSpec, contourPoints, contourPolyline, countInLeadSec, countInSchedule, countdownFactory, countdownRemaining, countdownSeconds, countingDegreeDemoSpec, countingTrackFactory, cropAroundBox, ctaFactory, cubicEaseInOut, cueOpacity, degreeLabel, degreeLabelsFactory, distinctMeasureIndices, distinctOnsets, dotAt, drawCaption, drawHighlight, droneSchedule, duckGainAt, easeIn, easeInOut, easeOut, endCardFactory, fallingKeyboardDemoScore, fallingKeyboardDemoSpec, fallingNotesFactory, firstMeasureBox, followBoxAt, followSrcBox, followWindowStart, fracSlotPoint, frameRect, fretboardFactory, functionColor, functionalHarmonyFactory, getKeyboardLayout, getLayerFactory, getNotationEngraving, harmonyDemoSpec, highlightIntensity, hookFactory, identityCamera, imageRevealFactory, inRange, intervalArcsFactory, invLerp, isBlackKey, karaokeCaptionFactory, kenBurns, keyCenterX, keyColumnWidth, keyRect, keySlot, keyboardFactory, keyboardLayout, kineticTextFactory, lerp, lerpBox, lerpCamera, linear, mapBoxThroughLayout, mcqCardFactory, mcqDemoSpec, measureColumnsFromLayout, measureCount, measureSpanBox, measureSpans, measureSystemMap, timeToX as minimapTimeToX, msPerBeat, notationFactory, notationLayout, noteColor, noteSetXRange, parseKey, parseTimeSig, particleBurstFactory, pcToSlot, pitchAt, pitchContourFactory, pitchRange, playheadLine, portraitFactory, progress01, progressRingFactory, projectPoint, promoCardsDemoSpec, pulseAt, quizPhase, radialSpectrumFactory, rayEndpoints, rayPointAt, recordSceneSpec, registerLayer, registeredKeys, resolveAnchor, resolveKeyboardLayout, resolveTimeline, revealFactory, revealProgress, runGate, safeGuidesFactory, scaleHighlightFactory, scoreFromMusicXML, scorePitchSpan, scrollCursorFactory, sectionMinimapFactory, setFollowLayoutProvider, setKeyboardLayout, setNotationEngraving, slotAngle, slotPc, slotPoint, spectrumFactory, staffAnchor, staffKeyboardRayFactory, staffRayDemoSpec, statCounterFactory, systemBox, tensionGraphFactory, textureFactory, transitionProgress, validateChordTrack, validateQuiz, validateSections, visualTimelineMs, vstackAudioPlayheadLine, vstackFollowBox, waveformFactory, whiteKeys, worldToViewport };
@@ -4766,11 +4766,18 @@ var endCardFactory = {
4766
4766
  };
4767
4767
 
4768
4768
  // src/scene/layers/imageReveal.ts
4769
+ function applyEasing(p, easing) {
4770
+ if (easing === "easeOut") return 1 - (1 - p) * (1 - p);
4771
+ if (easing === "easeOutStrong") return 1 - (1 - p) * (1 - p) * (1 - p);
4772
+ if (easing === "easeInOut") return p * p * (3 - 2 * p);
4773
+ return p;
4774
+ }
4769
4775
  var DEFAULTS11 = {
4770
4776
  mode: "pixelate",
4771
4777
  startMs: 0,
4772
4778
  durationMs: 6e3,
4773
- difficulty: 0.5
4779
+ difficulty: 0.5,
4780
+ easing: "linear"
4774
4781
  };
4775
4782
  function clamp017(x) {
4776
4783
  return x < 0 ? 0 : x > 1 ? 1 : x;
@@ -4799,6 +4806,7 @@ function imageRevealLayer() {
4799
4806
  let startMs = DEFAULTS11.startMs;
4800
4807
  let durationMs = DEFAULTS11.durationMs;
4801
4808
  let difficulty = DEFAULTS11.difficulty;
4809
+ let easing = DEFAULTS11.easing;
4802
4810
  let image = null;
4803
4811
  let offscreen = null;
4804
4812
  let offCtx = null;
@@ -4832,6 +4840,7 @@ function imageRevealLayer() {
4832
4840
  startMs = props.startMs ?? DEFAULTS11.startMs;
4833
4841
  durationMs = props.durationMs ?? DEFAULTS11.durationMs;
4834
4842
  difficulty = props.difficulty ?? DEFAULTS11.difficulty;
4843
+ easing = props.easing ?? DEFAULTS11.easing;
4835
4844
  image = props.image;
4836
4845
  const src = props.image;
4837
4846
  imgW = src["naturalWidth"] ?? src["displayWidth"] ?? src["width"] ?? 0;
@@ -4839,7 +4848,8 @@ function imageRevealLayer() {
4839
4848
  },
4840
4849
  draw(ctx, tMs) {
4841
4850
  if (!image || imgW === 0 || imgH === 0) return;
4842
- const p = clamp017((tMs - startMs) / (durationMs > 0 ? durationMs : 1));
4851
+ const raw = clamp017((tMs - startMs) / (durationMs > 0 ? durationMs : 1));
4852
+ const p = applyEasing(raw, easing);
4843
4853
  const sb = ctx.safeBox;
4844
4854
  const fit = fitRect(imgW, imgH, sb.left, sb.top, sb.w, sb.h);
4845
4855
  const c = ctx.ctx2d;
@@ -4951,6 +4961,7 @@ function drawShuffle(c, image, fit, p, difficulty, imgW, imgH) {
4951
4961
  }
4952
4962
  }
4953
4963
  var VALID_MODES = ["pixelate", "shuffle", "blur"];
4964
+ var VALID_EASINGS = ["linear", "easeOut", "easeOutStrong", "easeInOut"];
4954
4965
  var imageRevealFactory = {
4955
4966
  key: "image-reveal",
4956
4967
  create: imageRevealLayer,
@@ -4967,6 +4978,8 @@ var imageRevealFactory = {
4967
4978
  errs.push("image-reveal.durationMs must be a positive number");
4968
4979
  if (p["difficulty"] != null && (typeof p["difficulty"] !== "number" || p["difficulty"] < 0 || p["difficulty"] > 1))
4969
4980
  errs.push("image-reveal.difficulty must be a number in [0, 1]");
4981
+ if (p["easing"] != null && !VALID_EASINGS.includes(p["easing"]))
4982
+ errs.push(`image-reveal.easing must be one of: ${VALID_EASINGS.join(", ")}`);
4970
4983
  return errs;
4971
4984
  }
4972
4985
  };