Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
𝕏
✰
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } body { margin: 0; background: #0d0d0d; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ } body::-webkit-scrollbar { display: none; /* Chrome, Safari and Opera */ } section { position: relative; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; } .iphone { position: absolute; height: 600px; } .widgets { position: absolute; z-index: -1; scale: 0; } #socials { background: linear-gradient(#ff348b, #e30217); border-radius: 30px; aspect-ratio: 1; height: 140px; display: flex; justify-content: space-evenly; align-items: center; flex-wrap: wrap; } a { text-decoration: none; font-size: 30px; font-family: sans-serif; background-color: white; aspect-ratio: 1; height: 50px; border-radius: 100%; color: black; display: flex; justify-content: center; align-items: center; }
console.log("Event Fired") const iphone = document.querySelector(".iphone"); const widgets = document.querySelectorAll(".widgets"); gsap.set(iphone, { x: -450, rotation: 90 }); gsap.set(widgets, { opacity: 0, scale: 0 }); function iPhoneAnimation() { const tl = gsap.timeline({ defaults: { duration: 1 } }); tl.to(iphone, { x: 0 }) .to(iphone, { rotation: 0, scale: 0.9 }) .to(iphone, { duration: 3, scale: 1 }); return tl; } function widgetAnimation() { const tl = gsap.timeline(); tl.to(widgets, { duration: 0, opacity: 1 }); return tl; } const animations = [ { selector: "#app-store", duration: 3, scale: 0.9, x: 500, y: 100, ease: Power4.easeOut }, { selector: "#screen-time", duration: 3, scale: 0.9, x: -500, y: -300, ease: Power2.easeOut }, { selector: "#weather", duration: 3, scale: 1.1, x: -400, y: 350, ease: Power4.easeOut }, { selector: "#stocks", duration: 3, scale: 0.9, x: 530, y: -170, ease: Power4.easeOut }, { selector: "#fitness", duration: 3, scale: 1.1, x: -350, y: -100, ease: Power2.easeOut }, { selector: "#find-my", duration: 3, scale: 1.1, x: 400, y: -360, ease: Power4.easeOut }, { selector: "#calendar", duration: 3, scale: 0.9, x: -630, y: 0, ease: Power2.easeOut }, { selector: "#wallet", duration: 3, scale: 1, x: -280, y: 100, ease: Power4.easeOut }, { selector: "#apple-tv", duration: 3, scale: 1, x: 500, y: 300, ease: Power4.easeOut }, { selector: "#sleep", duration: 3, scale: 0.9, x: 270, y: -50, ease: Power2.easeOut }, { selector: "#socials", duration: 3, scale: 1, x: 330, y: 120, ease: Power2.easeOut } ]; const startTime = 2; const masterTimeline = gsap.timeline(); masterTimeline.add(iPhoneAnimation()).add(widgetAnimation(), startTime); animations.forEach((animation, index) => { const { selector, duration, scale, x, y, ease } = animation; const element = document.querySelector(selector); masterTimeline.add( gsap.to(element, { duration, scale, x, y, ease }), startTime + (index % 3) / 2 ); }); ScrollTrigger.create({ animation: masterTimeline, trigger: ".animation", scrub: 1, pin: true // markers: true });