Skip to content

Commit

Permalink
feat: 初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdong committed Aug 4, 2024
1 parent b42591e commit 37d5b2e
Show file tree
Hide file tree
Showing 3 changed files with 596 additions and 3 deletions.
67 changes: 65 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ hero:
<div class="place"></div>
</div>


<div class="container1">
</div>
<video class="video" muted src="/bbb.mp4" preload="auto"></video>






<style scoped>
.wrapper1{
display:grid;
Expand Down Expand Up @@ -57,7 +67,22 @@ hero:
height:100%;
border-radius:50%;
}

.container1{
width:100%;
height:800vh
}
.video{
z-index:-1;
opacity:0.8;
width:100%;
/* height:100vh; */
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
transform: translate(-50%, -50%);
}

</style>
<script setup>
Expand Down Expand Up @@ -137,7 +162,9 @@ Flip.from(state, {
onMounted(()=>{
place = document.querySelector('.place')
gsap.from('.item',{
scrollTrigger: '.wrapper1',
scrollTrigger: {
trigger: '.wrapper1',
},
opacity:0,
rotate:360,
scale: 0.1,
Expand Down Expand Up @@ -180,5 +207,41 @@ borderRadius:50,
});
});
});

const video = document.querySelector('.video')

video.addEventListener("loadedmetadata", () => {

gsap.to(
'.video',
{
currentTime:video.duration,
scrollTrigger: {
trigger: ".container1",
start: "top top",
end: "bottom bottom",
scrub: true,

// markers: true,
onUpdate: (self) => {
console.log(
'progress:',
self.progress.toFixed(3),
'direction:',
self.direction,
'velocity',
self.getVelocity()
);
}
}
}
);

})

})




</script>
Loading

0 comments on commit 37d5b2e

Please sign in to comment.