NEW

Code overide

Code overide

Apple Vision Pro Scroll Animation

This is the scroll animation from the Apple Vision Pro site, recreated in Framer. Feel free to remix the project and check out how it's built.

Yellow Flower
Yellow Flower

About the resource

The scroll animation effect leverages a mix of native Framer effects and some code overrides.

Elements of Vision Pro are moved using scroll transforms, triggered by scroll sections.

The video plays on scroll due to a scroll scrub code override applied to it.

I also employed sticky positioning, ensuring that the Vision Pro headset stays at the top of the viewport during the animation. An additional code override on the sticky container assures that the top value remains at 50vh, meaning the section halts in the center of the viewport.

You can copy both overrides from below.

Code override

Code override You can also copy this code to create a new code override in your project, which will make the galaxy background move as you hover over the button.

Code
import type { ComponentType } from "react"
import { useState, useEffect } from "react"
import type { MotionValue, Transition } from "framer-motion"
import { useViewportScroll, useTransform } from "framer-motion"
import { gsap } from "gsap"

export function withScrolledProgress(Component): ComponentType {
    const startY = 1000
    const distance = 1500
    const endY = startY + distance
    return (props) => {
        const { scrollY } = useViewportScroll()
        const progress = useTransform(scrollY, [startY, endY], [0, 1])
        useEffect(() => {
            const video = document.getElementById("video") as HTMLVideoElement
            gsap.to(video, {
                scrollTrigger: {
                    trigger: ".scroll-container",
                    start: "top top",
                    end: "bottom bottom",
                    scrub: 1,
                    markers: true,
                },
                keyframes: [
                    { progress: 0 },
                    { progress: 0.1 },
                    { progress: 0.2 },
                    { progress: 0.3 },
                    { progress: 0.4 },
                    { progress: 0.5 },
                    { progress: 0.6 },
                    { progress: 0.7 },
                    { progress: 0.8 },
                    { progress: 0.9 },
                    { progress: 1 },
                ],
                ease: "linear",
                duration: 10,
            })

            return () => {
                gsap.killTweensOf(video)
            }
        }, [scrollY, distance])

        return <Component {...props} progress={progress} />
    }
}

Bài trước

Bài kế tiếp

/NHẬN THÔNG BÁO

CTYTNHH DIA DEMY.

54/1A Đường số 30, P6, Q. Gò Vấp. HCM

/KHÁM PHÁ

Khóa học

Tài nguyên

Wiki

Podcast

@2019 DIA DEMY. ALL RIGHTS RESERVED.

DESIGN BY THAYTRI

/NHẬN THÔNG BÁO

CTYTNHH DIA DEMY.

54/1A Đường số 30, P6, Q. Gò Vấp. HCM

/KHÁM PHÁ

Khóa học

Tài nguyên

Wiki

Podcast

@2019 DIA DEMY. ALL RIGHTS RESERVED.

DESIGN BY THAYTRI

/NHẬN THÔNG BÁO

CTYTNHH DIA DEMY.

54/1A Đường số 30, P6, Q. Gò Vấp. HCM

/KHÁM PHÁ

Khóa học

Tài nguyên

Wiki

Podcast

@2019 DIA DEMY. ALL RIGHTS RESERVED.

DESIGN BY THAYTRI