embedded version defaults to video duration
This commit is contained in:
parent
e8b0d4fefd
commit
6ecd86cc2c
1 changed files with 15 additions and 6 deletions
|
|
@ -67,7 +67,6 @@
|
||||||
const defaultEmbedProps = {
|
const defaultEmbedProps = {
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
height: '80svh',
|
height: '80svh',
|
||||||
duration: 5000,
|
|
||||||
delay: 200,
|
delay: 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -117,10 +116,11 @@
|
||||||
}
|
}
|
||||||
return scrollHeight;
|
return scrollHeight;
|
||||||
});
|
});
|
||||||
|
|
||||||
const embeddedContainerScrollY = new Tween(0, {
|
const embeddedContainerScrollY = new Tween(0, {
|
||||||
duration: allEmbedProps.duration,
|
duration: 1000,
|
||||||
delay: allEmbedProps.delay,
|
delay: allEmbedProps.delay,
|
||||||
easing: (t) => t,
|
easing: (t) => +t,
|
||||||
});
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|
@ -158,9 +158,18 @@
|
||||||
embeddedContainer.getBoundingClientRect().top <
|
embeddedContainer.getBoundingClientRect().top <
|
||||||
window.innerHeight * allEmbedProps.threshold
|
window.innerHeight * allEmbedProps.threshold
|
||||||
) {
|
) {
|
||||||
if (embeddedContainerScrollY.current == 0) {
|
if (
|
||||||
embeddedContainerScrollY.target =
|
embeddedContainerScrollY.current == 0 &&
|
||||||
embeddedContainerScrollHeight;
|
embeddedContainerHeight &&
|
||||||
|
scrollerVideo?.componentState
|
||||||
|
) {
|
||||||
|
const scrollDuration =
|
||||||
|
allEmbedProps.duration ||
|
||||||
|
scrollerVideo.componentState.generalData.totalTime * 1000;
|
||||||
|
embeddedContainerScrollY.set(embeddedContainerScrollHeight, {
|
||||||
|
duration: scrollDuration,
|
||||||
|
delay: allEmbedProps.delay,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
embeddedContainer &&
|
embeddedContainer &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue