change the 404 poke animation again lol
This commit is contained in:
parent
a4b3d74af3
commit
4065f0cd84
BIN
public/images/coralz_idle.png
Normal file
BIN
public/images/coralz_idle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 177 KiB |
@ -11,7 +11,7 @@
|
|||||||
0%, 100% {
|
0%, 100% {
|
||||||
transform: translate(0px, 0px) scale(1, 1);
|
transform: translate(0px, 0px) scale(1, 1);
|
||||||
}
|
}
|
||||||
15% {
|
10% {
|
||||||
transform: translate(0px, 14px) scale(1.2, 0.9);
|
transform: translate(0px, 14px) scale(1.2, 0.9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,9 @@ export default function NotFound() {
|
|||||||
</noscript>
|
</noscript>
|
||||||
<WobblingImage
|
<WobblingImage
|
||||||
images={{
|
images={{
|
||||||
idle: "/images/coralz_0.png",
|
idle: "/images/coralz_idle.png",
|
||||||
poked: "/images/coralz_1.png"
|
aware: "/images/coralz_scared.png",
|
||||||
|
poked: "/images/coralz_poked.png"
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="-mt-2">
|
<div className="-mt-2">
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import Image from "next/image"
|
|||||||
import { FloatingLabel } from "./floating-label"
|
import { FloatingLabel } from "./floating-label"
|
||||||
|
|
||||||
export const LandingImage = () => (
|
export const LandingImage = () => (
|
||||||
<FloatingLabel placeholder="Coral Glasses ❤️. Alert: NOT MY WORK! character by JoelG, See terms and conditions">
|
<FloatingLabel placeholder="Coral Glasses ❤️. Alert: NOT MY WORK! See the end of the page">
|
||||||
<Image
|
<Image
|
||||||
className="mb-8 mx-auto"
|
className="mb-8 mx-auto"
|
||||||
alt="Coral <3"
|
alt="Coral <3"
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { useCallback, useEffect, useRef, useState } from "react"
|
|||||||
interface WobblingImageInterface {
|
interface WobblingImageInterface {
|
||||||
images: {
|
images: {
|
||||||
idle: string;
|
idle: string;
|
||||||
|
aware?: string;
|
||||||
poked?: string;
|
poked?: string;
|
||||||
weird?: string;
|
weird?: string;
|
||||||
}
|
}
|
||||||
@ -17,6 +18,7 @@ function WobblingImage ({
|
|||||||
}: WobblingImageInterface) {
|
}: WobblingImageInterface) {
|
||||||
const size = 400;
|
const size = 400;
|
||||||
const [isPoked, setPoked] = useState(false);
|
const [isPoked, setPoked] = useState(false);
|
||||||
|
const [isAware, setAware] = useState(false);
|
||||||
const pokeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
const pokeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
const [isAnimating, setIsAnimating] = useState(false);
|
const [isAnimating, setIsAnimating] = useState(false);
|
||||||
@ -70,8 +72,8 @@ function WobblingImage ({
|
|||||||
if (!audioBuffer || !audioContextRef.current) return;
|
if (!audioBuffer || !audioContextRef.current) return;
|
||||||
|
|
||||||
const context = audioContextRef.current;
|
const context = audioContextRef.current;
|
||||||
const changeToLowPitch = Math.floor(Math.random() * 10);
|
const changeToLowPitch = Math.floor(Math.random() * 66);
|
||||||
const randomPitch = Math.random() * 0.2 + (changeToLowPitch == 1 ? 0.25 : 0.85);
|
const randomPitch = Math.random() * 0.38 + (changeToLowPitch == 1 ? 0.25 : 0.75);
|
||||||
|
|
||||||
const source = context.createBufferSource();
|
const source = context.createBufferSource();
|
||||||
source.buffer = audioBuffer;
|
source.buffer = audioBuffer;
|
||||||
@ -86,6 +88,9 @@ function WobblingImage ({
|
|||||||
|
|
||||||
|
|
||||||
function handleClick() {
|
function handleClick() {
|
||||||
|
const pokedDuration = 700 + Math.floor(Math.random() * 100)
|
||||||
|
if (!isAware) setAware(true);
|
||||||
|
|
||||||
setIsAnimating(false);
|
setIsAnimating(false);
|
||||||
requestAnimationFrame(() => setIsAnimating(true));
|
requestAnimationFrame(() => setIsAnimating(true));
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ function WobblingImage ({
|
|||||||
setPoked(true);
|
setPoked(true);
|
||||||
pokeTimeoutRef.current = setTimeout(() => {
|
pokeTimeoutRef.current = setTimeout(() => {
|
||||||
setPoked(false);
|
setPoked(false);
|
||||||
}, 600);
|
}, pokedDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAnimationEnd() {
|
function handleAnimationEnd() {
|
||||||
@ -112,8 +117,8 @@ function WobblingImage ({
|
|||||||
<div className="">
|
<div className="">
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"relative mx-auto cursor-grab h-[400px] select-none",
|
"relative mx-auto cursor-grab active:cursor-grabbing h-[400px] select-none",
|
||||||
isAnimating && "animate-[click-bounce_250ms_ease-out]"
|
isAnimating && "animate-[click-bounce_230ms_ease-out]"
|
||||||
)}
|
)}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
onAnimationEnd={handleAnimationEnd}
|
onAnimationEnd={handleAnimationEnd}
|
||||||
@ -126,7 +131,7 @@ function WobblingImage ({
|
|||||||
<Image
|
<Image
|
||||||
className={clsx("absolute left-1/2 -translate-x-1/2 top-0 pointer-events-none", isPoked ? "opacity-0" : "opacity-100")}
|
className={clsx("absolute left-1/2 -translate-x-1/2 top-0 pointer-events-none", isPoked ? "opacity-0" : "opacity-100")}
|
||||||
alt="clip1"
|
alt="clip1"
|
||||||
src={images.idle}
|
src={isAware ? (images.aware || images.idle) : images.idle}
|
||||||
width={size}
|
width={size}
|
||||||
height={size}
|
height={size}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user