updates transitionSpeed for videoPercentage reactivity
This commit is contained in:
parent
1e58b1bf76
commit
e8995cff48
3 changed files with 12 additions and 3 deletions
|
|
@ -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()}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,11 @@
|
|||
videoPercentage >= 0 &&
|
||||
videoPercentage <= 1
|
||||
) {
|
||||
scrollerVideo.setVideoPercentage(videoPercentage);
|
||||
scrollerVideo.setVideoPercentage(videoPercentage, {
|
||||
jump: false,
|
||||
easing: (t) => t,
|
||||
transitionSpeed: restProps.transitionSpeed,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Reference in a new issue