updates transitionSpeed for videoPercentage reactivity

This commit is contained in:
Sudev Kiyada 2026-01-12 15:50:39 +05:30
parent 1e58b1bf76
commit e8995cff48
Failed to extract signature
3 changed files with 12 additions and 3 deletions

View file

@ -348,8 +348,10 @@ The `ScrollerVideo` component can be used inside the [ScrollerBase](?path=/story
<!-- Pass bindable prop `progress` as `videoPercentage` and set `trackScroll` to `false` -->
<ScrollerVideo
src="my-video.mp4"
videoPercentage={progress}
height="100lvh"
videoPercentage={Math.min(1, Math.max(progress, 0))}
trackScroll={false}
transitionSpeed={20}
/>
{/snippet}
{#snippet foregroundSnippet()}

View file

@ -200,7 +200,11 @@
videoPercentage >= 0 &&
videoPercentage <= 1
) {
scrollerVideo.setVideoPercentage(videoPercentage);
scrollerVideo.setVideoPercentage(videoPercentage, {
jump: false,
easing: (t) => t,
transitionSpeed: restProps.transitionSpeed,
});
}
}
});

View file

@ -5,6 +5,8 @@
// ScrollerBase props
let progress = $state(0);
let scrollerVideo = $state(undefined);
</script>
<ScrollerBase bind:progress query="div.step-foreground-container" visible>
@ -13,7 +15,8 @@
src={Goldengate}
height="100lvh"
trackScroll={false}
videoPercentage={progress}
videoPercentage={Math.min(1, Math.max(progress, 0))}
transitionSpeed={20}
showDebugInfo
/>
{/snippet}