NEW

Code overide

Code overide

Avara Site in Framer

This is the Avara site, recreated in Framer without writing a single line of code. Feel free to remix the project and check out how it's built.

About the resource

This site's rebuild exclusively utilizes native Framer features, with just a bit of coding required to play sounds when clicking certain elements. (You'll find the code override outlined separately below.)

I put together 29 components to establish all the user interactions. Oh, and the site is fully responsive; so yeah, it's all set for you to check out on mobile as well.

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 React, { ComponentType, useRef } from "react"

const soundUrls = {
    click: "https://avara.xyz/sounds/click.wav",
    error: "https://avara.xyz/sounds/error.wav",
    open: "https://avara.xyz/sounds/open.wav",
    close: "https://avara.xyz/sounds/close.wav",
    forward: "https://avara.xyz/sounds/forward.wav",
    back: "https://avara.xyz/sounds/back.wav",
}

function useSound(url: string): HTMLAudioElement {
    const audioRef = useRef(new Audio(url))

    return audioRef.current
}

function isTouchDevice() {
    return "ontouchstart" in window
}

export function withError(Component): ComponentType {
    return (props) => {
        const clickSound = useSound(soundUrls.click)
        const errorSound = useSound(soundUrls.error)

        const handleStart = () => clickSound.play()
        const handleEnd = () => errorSound.play()

        const events = isTouchDevice()
            ? { onTouchStart: handleStart, onTouchEnd: handleEnd }
            : { onMouseDown: handleStart, onMouseUp: handleEnd }

        return <Component {...props} {...events} />
    }
}

export function withFigure(Component): ComponentType {
    return (props) => {
        const clickSound = useSound(soundUrls.click)
        const openSound = useSound(soundUrls.open)

        const handleStart = () => clickSound.play()
        const handleEnd = () => openSound.play()

        const events = isTouchDevice()
            ? { onTouchStart: handleStart, onTouchEnd: handleEnd }
            : { onMouseDown: handleStart, onMouseUp: handleEnd }

        return <Component {...props} {...events} />
    }
}

export function withLeave(Component): ComponentType {
    return (props: any) => {
        const closeSound = useSound(soundUrls.close)

        const handleEnd = () => closeSound.play()

        const events = isTouchDevice()
            ? { onTouchEnd: handleEnd }
            : { onMouseUp: handleEnd }

        return <Component {...props} {...events} />
    }
}

export function withForward(Component): ComponentType {
    return (props) => {
        const forwardSound = useSound(soundUrls.forward)

        const handleEnd = () => forwardSound.play()

        const events = isTouchDevice()
            ? { onTouchEnd: handleEnd }
            : { onMouseUp: handleEnd }

        return <Component {...props} {...events} />
    }
}

export function withBack(Component): ComponentType {
    return (props) => {
        const backSound = useSound(soundUrls.back)

        const handleEnd = () => backSound.play()

        const events = isTouchDevice()
            ? { onTouchEnd: handleEnd }
            : { onMouseUp: handleEnd }

        return <Component {...props} {...events} />
    }
}

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