This commit is contained in:
Saahil dutta 2024-06-11 22:37:31 -04:00
parent 4f3d91762b
commit 6e2a3cd870
Signed by: neon
GPG key ID: 8A8B64515254CFC6
30 changed files with 2525 additions and 1530 deletions

View file

@ -1,11 +1,12 @@
import React from 'react';
import Main from './components/main';
// import logo from './logo.svg';
// import './App.css';
function App() {
return (
<div className="App">
<div style={{ zIndex: 9999 }}>
<Main />
</div>
);
}

12
src/bg/main.tsx Normal file
View file

@ -0,0 +1,12 @@
import "./style.css";
export default function Background() {
return (
<div style={{ filter: 'blur(10px)'}}>
<ul className="background">
{new Array(49).join('.').split('.').map((_,i) => {
return <li key={i} className={i % 2 === 0 ? "bg-effect" : ""}></li>
})}
</ul>
</div>
)
}

407
src/bg/style.css Normal file
View file

@ -0,0 +1,407 @@
@keyframes animate {
0%{
transform: translateY(0) rotate(0deg);
opacity: 1;
border-radius: 0;
}
100%{
transform: translateY(-1000px) rotate(720deg);
opacity: 0;
border-radius: 50%;
}
}
@keyframes animate-inverse {
0%{
transform: translateY(0) rotate(720deg);
opacity: 1;
border-radius: 0;
}
100%{
transform: translateY(-1000px) rotate(0deg);
opacity: 0;
border-radius: 50%;
}
}
.bg-effect {
/* transform: scale3d(100.1, 1, 100.1); */
animation: animate 20s linear infinite;
}
.background {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
margin: 0;
padding: 0;
overflow: hidden;
/* @apply bg-base-300; */
/* @apply bg-gradient-to-b from-ctp-mantle to-ctp-crust; */
background: linear-gradient( var(--mantle), var(--crust));
/* backdrop-filter: blur(10px); */
}
.background li {
position: absolute;
display: block;
list-style: none;
width: 20px;
height: 20px;
/* background: rgba(255, 255, 255, 0.1); */
background: rgba(203, 166, 247, 0.15);
animation: animate 24s linear infinite;
}
.background li:nth-child(0) {
left: 12%;
width: 85px;
height: 85px;
bottom: -85px;
animation-delay: 1s;
background: var(--zeon-bonus-color-lighter) !important;
}
.background li:nth-child(1) {
left: 49%;
width: 34px;
height: 34px;
bottom: -34px;
animation-delay: 1s;
}
.background li:nth-child(2) {
left: 61%;
width: 30px;
height: 30px;
bottom: -30px;
animation-delay: 9s;
}
.background li:nth-child(3) {
left: 54%;
width: 96px;
height: 96px;
bottom: -96px;
animation-delay: 8s;
}
.background li:nth-child(4) {
left: 3%;
width: 57px;
height: 57px;
bottom: -57px;
animation-delay: 12s;
}
.background li:nth-child(5) {
left: 8%;
width: 45px;
height: 45px;
bottom: -45px;
animation-delay: 23s;
}
.background li:nth-child(6) {
left: 3%;
width: 82px;
height: 82px;
bottom: -82px;
animation-delay: 5s;
}
.background li:nth-child(7) {
left: 63%;
width: 87px;
height: 87px;
bottom: -87px;
animation-delay: 10s;
}
.background li:nth-child(8) {
left: 86%;
width: 30px;
height: 30px;
bottom: -30px;
animation-delay: 14s;
}
.background li:nth-child(9) {
left: 23%;
width: 56px;
height: 56px;
bottom: -56px;
animation-delay: 17s;
}
.background li:nth-child(10) {
left: 16%;
width: 97px;
height: 97px;
bottom: -97px;
animation-delay: 31s;
}
.background li:nth-child(11) {
left: 43%;
width: 82px;
height: 82px;
bottom: -82px;
animation-delay: 21s;
}
.background li:nth-child(12) {
left: 74%;
width: 31px;
height: 31px;
bottom: -31px;
animation-delay: 35s;
}
.background li:nth-child(13) {
left: 19%;
width: 97px;
height: 97px;
bottom: -97px;
animation-delay: 57s;
}
.background li:nth-child(14) {
left: 48%;
width: 21px;
height: 21px;
bottom: -21px;
animation-delay: 65s;
}
.background li:nth-child(15) {
left: 34%;
width: 69px;
height: 69px;
bottom: -69px;
animation-delay: 18s;
}
.background li:nth-child(16) {
left: 74%;
width: 31px;
height: 31px;
bottom: -31px;
animation-delay: 68s;
}
.background li:nth-child(17) {
left: 13%;
width: 41px;
height: 41px;
bottom: -41px;
animation-delay: 81s;
}
.background li:nth-child(18) {
left: 30%;
width: 64px;
height: 64px;
bottom: -64px;
animation-delay: 27s;
}
.background li:nth-child(19) {
left: 56%;
width: 59px;
height: 59px;
bottom: -59px;
animation-delay: 79s;
}
.background li:nth-child(20) {
left: 0%;
width: 53px;
height: 53px;
bottom: -53px;
animation-delay: 55s;
}
.background li:nth-child(21) {
left: 30%;
width: 82px;
height: 82px;
bottom: -82px;
animation-delay: 1s;
}
.background li:nth-child(22) {
left: 25%;
width: 2px;
height: 2px;
bottom: -2px;
animation-delay: 15s;
}
.background li:nth-child(23) {
left: 11%;
width: 34px;
height: 34px;
bottom: -34px;
animation-delay: 88s;
}
.background li:nth-child(24) {
left: 88%;
width: 88px;
height: 88px;
bottom: -88px;
animation-delay: 113s;
}
.background li:nth-child(25) {
left: 42%;
width: 61px;
height: 61px;
bottom: -61px;
animation-delay: 24s;
}
.background li:nth-child(26) {
left: 48%;
width: 98px;
height: 98px;
bottom: -98px;
animation-delay: 14s;
}
.background li:nth-child(27) {
left: 81%;
width: 20px;
height: 20px;
bottom: -20px;
animation-delay: 4s;
}
.background li:nth-child(28) {
left: 36%;
width: 68px;
height: 68px;
bottom: -68px;
animation-delay: 31s;
}
.background li:nth-child(29) {
left: 80%;
width: 81px;
height: 81px;
bottom: -81px;
animation-delay: 72s;
}
.background li:nth-child(30) {
left: 86%;
width: 78px;
height: 78px;
bottom: -78px;
animation-delay: 114s;
}
.background li:nth-child(31) {
left: 31%;
width: 68px;
height: 68px;
bottom: -68px;
animation-delay: 141s;
}
.background li:nth-child(32) {
left: 24%;
width: 15px;
height: 15px;
bottom: -15px;
animation-delay: 129s;
}
.background li:nth-child(33) {
left: 60%;
width: 98px;
height: 98px;
bottom: -98px;
animation-delay: 101s;
}
.background li:nth-child(34) {
left: 71%;
width: 19px;
height: 19px;
bottom: -19px;
animation-delay: 78s;
}
.background li:nth-child(35) {
left: 31%;
width: 32px;
height: 32px;
bottom: -32px;
animation-delay: 23s;
}
.background li:nth-child(36) {
left: 7%;
width: 70px;
height: 70px;
bottom: -70px;
animation-delay: 169s;
}
.background li:nth-child(37) {
left: 3%;
width: 26px;
height: 26px;
bottom: -26px;
animation-delay: 98s;
}
.background li:nth-child(38) {
left: 4%;
width: 50px;
height: 50px;
bottom: -50px;
animation-delay: 124s;
}
.background li:nth-child(39) {
left: 34%;
width: 51px;
height: 51px;
bottom: -51px;
animation-delay: 30s;
}
.background li:nth-child(40) {
left: 61%;
width: 59px;
height: 59px;
bottom: -59px;
animation-delay: 49s;
}
.background li:nth-child(41) {
left: 78%;
width: 45px;
height: 45px;
bottom: -45px;
animation-delay: 184s;
}
.background li:nth-child(42) {
left: 25%;
width: 58px;
height: 58px;
bottom: -58px;
animation-delay: 152s;
}
.background li:nth-child(43) {
left: 20%;
width: 76px;
height: 76px;
bottom: -76px;
animation-delay: 157s;
}
.background li:nth-child(44) {
left: 44%;
width: 59px;
height: 59px;
bottom: -59px;
animation-delay: 5s;
}
.background li:nth-child(45) {
left: 36%;
width: 88px;
height: 88px;
bottom: -88px;
animation-delay: 217s;
}
.background li:nth-child(46) {
left: 78%;
width: 43px;
height: 43px;
bottom: -43px;
animation-delay: 185s;
}
.background li:nth-child(47) {
left: 59%;
width: 58px;
height: 58px;
bottom: -58px;
animation-delay: 91s;
}
.background li:nth-child(48) {
left: 87%;
width: 73px;
height: 73px;
bottom: -73px;
animation-delay: 226s;
}
.background li:nth-child(49) {
left: 43%;
width: 79px;
height: 79px;
bottom: -79px;
animation-delay: 84s;
}

View file

@ -0,0 +1,32 @@
@keyframes float {
0% {
/* box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); */
transform: translatey(0px);
}
50% {
/* box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2); */
transform: translatey(-20px);
}
100% {
/* box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); */
transform: translatey(0px);
}
}
.avatar {
width: 150px;
height: 150px;
box-sizing: border-box; /* Not needed */
/*
border: 5px white solid;
border-radius: 50%;
*/
background: transparent;
overflow: hidden;
/* box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); */
transform: translatey(0px);
animation: float 6s ease-in-out infinite;
}
.avatar img {
width: 100%;
height: auto;
}

View file

@ -0,0 +1,25 @@
import './avatar.css'
import ScrollAnimation from 'react-animate-on-scroll'
import Tilt from 'react-parallax-tilt'
// import 'animate.css/animate.css'
export default function Main() {
return (
<div className='hero min-h-screen ' >
<div style={{ animation: "fadeInDown", animationDuration: "1.5s", zIndex: 9999 }} className='animate__animated animate__fadeIn' >
<div className='hero-content flex-col lg:flex-row max-w-xl' style={{ zIndex: 9999 }}>
<div className='avatar'>
<Tilt glareEnable glareColor={'#f9e2af'}>
<img src={'favicon.png'} />
</Tilt>
</div>
<div style={{ zIndex: 9999 }}>
<h1 className='text-5xl font-bold zeon-word' >Saahild.com</h1>
<p>WIP.</p>
</div>
</div>
</div>
</div>
)
}

View file

@ -1,3 +1,35 @@
/* tailwind root */
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--rosewater: #f5e0dc;
--flamingo: #f2cdcd;
--pink: #f5c2e7;
--mauve: #cba6f7;
--red: #f38ba8;
--maroon: #eba0ac;
--peach: #fab387;
--yellow: #f9e2af;
--green: #a6e3a1;
--teal: #94e2d5;
--sky: #89dceb;
--sapphire: #74c7ec;
--blue: #89b4fa;
--lavender: #b4befe;
--text: #cdd6f4;
--subtext1: #bac2de;
--subtext0: #a6adc8;
--overlay2: #9399b2;
--overlay1: #7f849c;
--overlay0: #6c7086;
--surface2: #585b70;
--surface1: #45475a;
--surface0: #313244;
--base: #1e1e2e;
--mantle: #181825;
--crust: #11111b;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',

View file

@ -1,14 +1,19 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import "animate.css/animate.compat.css";
import ReactDOM from 'react-dom/client';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Background from './bg/main';
import { injectOneko } from './scripts/oneko';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
injectOneko();
document.title = 'React App';
root.render(
<React.StrictMode>
<Background />
<App />
</React.StrictMode>
);
@ -16,4 +21,4 @@ root.render(
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
reportWebVitals(console.log);

240
src/scripts/oneko.ts Normal file
View file

@ -0,0 +1,240 @@
// oneko.js: https://github.com/adryd325/oneko.js
// modified by @NeonGamerBot-QK
export const nekoEl = document.createElement("div");
export function deleteOneko(): void {
return nekoEl.remove();
}
export function injectOneko():void {
const isReducedMotion = window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true;
if (isReducedMotion) return;
let nekoPosX = 32;
let nekoPosY = 32;
let mousePosX = 0;
let mousePosY = 0;
let frameCount = 0;
let idleTime = 0;
let idleAnimation: null | number | string = null;
let idleAnimationFrame = 0;
const nekoSpeed = 10;
const spriteSets = {
idle: [[-3, -3]],
alert: [[-7, -3]],
scratchSelf: [
[-5, 0],
[-6, 0],
[-7, 0],
],
scratchWallN: [
[0, 0],
[0, -1],
],
scratchWallS: [
[-7, -1],
[-6, -2],
],
scratchWallE: [
[-2, -2],
[-2, -3],
],
scratchWallW: [
[-4, 0],
[-4, -1],
],
tired: [[-3, -2]],
sleeping: [
[-2, 0],
[-2, -1],
],
N: [
[-1, -2],
[-1, -3],
],
NE: [
[0, -2],
[0, -3],
],
E: [
[-3, 0],
[-3, -1],
],
SE: [
[-5, -1],
[-5, -2],
],
S: [
[-6, -3],
[-7, -2],
],
SW: [
[-5, -3],
[-6, -1],
],
W: [
[-4, -2],
[-4, -3],
],
NW: [
[-1, 0],
[-1, -1],
],
};
function init() {
nekoEl.id = "oneko";
nekoEl.ariaHidden = "true";
nekoEl.style.width = "32px";
nekoEl.style.height = "32px";
nekoEl.style.position = "fixed";
nekoEl.style.pointerEvents = "none";
nekoEl.style.imageRendering = "pixelated";
nekoEl.style.left = `${nekoPosX - 16}px`;
nekoEl.style.top = `${nekoPosY - 16}px`;
nekoEl.style.zIndex = Number.MAX_VALUE.toString();
let nekoFile = "https://saahild.com/oneko.gif"
const curScript = document.currentScript
if (curScript && curScript.dataset.cat) {
nekoFile = curScript.dataset.cat
}
nekoEl.style.backgroundImage = `url(${nekoFile})`;
document.body.appendChild(nekoEl);
document.addEventListener("mousemove", function (event) {
mousePosX = event.clientX;
mousePosY = event.clientY;
});
window.requestAnimationFrame(onAnimationFrame);
}
let lastFrameTimestamp: undefined | number = undefined;
function onAnimationFrame(timestamp: number) {
// Stops execution if the neko element is removed from DOM
if (!nekoEl.isConnected) {
return;
}
if (!lastFrameTimestamp) {
lastFrameTimestamp = timestamp;
}
if (timestamp - lastFrameTimestamp > 100) {
lastFrameTimestamp = timestamp
frame()
}
window.requestAnimationFrame(onAnimationFrame);
}
function setSprite(name: string, frame: number) {
//@ts-ignore
const sprite = spriteSets[name][frame % spriteSets[name].length];
nekoEl.style.backgroundPosition = `${sprite[0] * 32}px ${sprite[1] * 32}px`;
}
function resetIdleAnimation() {
idleAnimation = null;
idleAnimationFrame = 0;
}
function idle() {
idleTime += 1;
// every ~ 20 seconds
if (
idleTime > 10 &&
Math.floor(Math.random() * 200) == 0 &&
idleAnimation == null
) {
let avalibleIdleAnimations = ["sleeping", "scratchSelf"];
if (nekoPosX < 32) {
avalibleIdleAnimations.push("scratchWallW");
}
if (nekoPosY < 32) {
avalibleIdleAnimations.push("scratchWallN");
}
if (nekoPosX > window.innerWidth - 32) {
avalibleIdleAnimations.push("scratchWallE");
}
if (nekoPosY > window.innerHeight - 32) {
avalibleIdleAnimations.push("scratchWallS");
}
idleAnimation =
avalibleIdleAnimations[
Math.floor(Math.random() * avalibleIdleAnimations.length)
];
}
switch (idleAnimation) {
case "sleeping":
if (idleAnimationFrame < 8) {
setSprite("tired", 0);
break;
}
setSprite("sleeping", Math.floor(idleAnimationFrame / 4));
if (idleAnimationFrame > 192) {
resetIdleAnimation();
}
break;
case "scratchWallN":
case "scratchWallS":
case "scratchWallE":
case "scratchWallW":
case "scratchSelf":
setSprite(idleAnimation, idleAnimationFrame);
if (idleAnimationFrame > 9) {
resetIdleAnimation();
}
break;
default:
setSprite("idle", 0);
return;
}
idleAnimationFrame += 1;
}
function frame() {
frameCount += 1;
const diffX = nekoPosX - mousePosX;
const diffY = nekoPosY - mousePosY;
const distance = Math.sqrt(diffX ** 2 + diffY ** 2);
if (distance < nekoSpeed || distance < 48) {
idle();
return;
}
idleAnimation = null;
idleAnimationFrame = 0;
if (idleTime > 1) {
setSprite("alert", 0);
// count down after being alerted before moving
idleTime = Math.min(idleTime, 7);
idleTime -= 1;
return;
}
let direction;
direction = diffY / distance > 0.5 ? "N" : "";
direction += diffY / distance < -0.5 ? "S" : "";
direction += diffX / distance > 0.5 ? "W" : "";
direction += diffX / distance < -0.5 ? "E" : "";
setSprite(direction, frameCount);
nekoPosX -= (diffX / distance) * nekoSpeed;
nekoPosY -= (diffY / distance) * nekoSpeed;
nekoPosX = Math.min(Math.max(16, nekoPosX), window.innerWidth - 16);
nekoPosY = Math.min(Math.max(16, nekoPosY), window.innerHeight - 16);
nekoEl.style.left = `${nekoPosX - 16}px`;
nekoEl.style.top = `${nekoPosY - 16}px`;
}
init();
}