scrolltrigger hero page

This commit is contained in:
365884
2026-03-07 12:45:19 +01:00
parent b3bc957ec1
commit e4cd6977a9

View File

@@ -2,6 +2,9 @@
import { onMounted, onUnmounted, ref } from "vue" import { onMounted, onUnmounted, ref } from "vue"
import gsap from "gsap" import gsap from "gsap"
import ScrollTrigger from "gsap/ScrollTrigger"
gsap.registerPlugin(ScrollTrigger)
@@ -13,32 +16,42 @@ function toggleTimeline() {
tl.reversed(!tl.reversed()) tl.reversed(!tl.reversed())
} }
function startNextAnimation() { function startNextAnimation() {
ctx = gsap.context((self) => { ctx = gsap.context(() => {
const boxes = gsap.utils.toArray('.box')
tl = gsap.timeline({delay:2}) const boxes = gsap.utils.toArray(".box")
tl = gsap.timeline({
scrollTrigger: {
trigger: ".scroll-trigger-ready__worm-wrap",
start: "top 00%",
end: "bottom 30%",
scrub: 1
}
})
tl
.to(boxes[0], { x: gsap.utils.random(300, 600), rotate: 180 }) .to(boxes[0], { x: gsap.utils.random(300, 600), rotate: 180 })
.to(boxes[1], {x:-gsap.utils.random(300, 500), rotate: -180}, '<') .to(boxes[1], { x: -gsap.utils.random(300, 500), rotate: -180 }, "<")
.to(boxes[2], { x: gsap.utils.random(300, 400), rotate: 180 }) .to(boxes[2], { x: gsap.utils.random(300, 400), rotate: 180 })
.to(boxes[3], { x: gsap.utils.random(300, 500), rotate: 180 }) .to(boxes[3], { x: gsap.utils.random(300, 500), rotate: 180 })
.to(boxes[4], {x: - gsap.utils.random(300, 400), rotate: -180}, '<') .to(boxes[4], { x: -gsap.utils.random(300, 400), rotate: -180 }, "<")
.to(boxes[5], { x: gsap.utils.random(300, 500), rotate: 180 }) .to(boxes[5], { x: gsap.utils.random(300, 500), rotate: 180 })
.to(boxes[6], { x: -gsap.utils.random(300, 600), rotate: 180 }) .to(boxes[6], { x: -gsap.utils.random(300, 600), rotate: 180 })
.to(".title", { .to(".title", {
y: window.innerHeight - 130, y: window.innerHeight - 130,
duration: 1.2, duration: 4.0,
ease: "power2.inOut" ease: "power2.inOut"
}) }, 0)
.reverse();
}, main.value); }, main.value)
} }
onMounted(() => { onMounted(() => {
startNextAnimation(); startNextAnimation();
tl.reversed(false);
}); });
onUnmounted(() => { onUnmounted(() => {
ctx.revert() ctx?.revert()
}) })
@@ -83,17 +96,13 @@ onUnmounted(() => {
color: #ffffff; color: #ffffff;
font-size: clamp(2rem, 12rem, 5vw); font-size: clamp(2rem, 12rem, 5vw);
box-sizing: border-box; box-sizing: border-box;
font-display: block; font-display: block;
font-style: normal; font-style: normal;
font-weight: bold; font-weight: bold;
}
.titel {
font-weight: 900;
font-size: clamp(3rem, 6vw, 6rem);
} }
.box { .box {
width: 100px; width: 100px;
@@ -102,6 +111,22 @@ onUnmounted(() => {
border-radius: 20%; border-radius: 20%;
} }
.box:nth-child(2) {
background: linear-gradient(111.45deg, #ffffff 19.42%, #39ffba 73.08%);
}
.box:nth-child(3) {
background: linear-gradient(111.45deg, #ffffff 56.42%, #aed1e3 73.08%);
}
.box:nth-child(4) {
background: linear-gradient(111.45deg, #ffffff 90.42%, #f8e3bd 12.08%);
}
.box:nth-child(5) {
background: linear-gradient(111.45deg, #ffffff 19.42%, #76aaee 73.08%);
}