Oyen si kucing oren melirik ke arah kursormu dengan Math.atan2, berkedip dan menguap kalau dibiarkan, lalu mendengkur saat dielus. Semua digambar dengan SVG…
Oleh @belajarweb · JavaScript
<!doctype html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oyen, Kucing Penjaga Kursor</title>
<style>
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
background: #24464f;
font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
.kamar {
--oyen-h: min(60vh, 101vw);
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background:
repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 46px, rgba(0,0,0,.03) 46px 92px),
linear-gradient(#1d3b45, #2b5761 55%, #33626a 74%);
}
.kamar-lampu {
position: absolute; inset: 0;
background:
radial-gradient(ellipse 46% 52% at 58% 58%, rgba(255,196,120,.34), rgba(255,196,120,0) 70%),
radial-gradient(ellipse 30% 40% at 22% 30%, rgba(150,180,255,.14), rgba(150,180,255,0) 70%);
pointer-events: none;
}
/* jendela kayu */
.jendela {
position: absolute;
left: 6%; top: 8%;
width: clamp(150px, 31vw, 330px);
aspect-ratio: 300 / 260;
}
.jendela-svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 10px 14px rgba(0,0,0,.3)); }
.tirai {
position: absolute; top: -9%; height: 112%; width: 26%;
background:
repeating-linear-gradient(90deg, #b8432f 0 7px, #d9734a 7px 10px, #8f2f24 10px 13px, #c95638 13px 22px, #e9c27a 22px 24px);
box-shadow: inset -10px 0 18px rgba(0,0,0,.28), 0 8px 18px rgba(0,0,0,.25);
z-index: 2;
}
.tirai-kiri { left: -13%; border-radius: 0 0 40% 8% / 0 0 14% 4%; clip-path: polygon(0 0, 100% 0, 100% 44%, 46% 56%, 74% 100%, 0 100%); }
.tirai-kanan { right: -13%; border-radius: 0 0 8% 40% / 0 0 4% 14%; clip-path: polygon(0 0, 100% 0, 100% 100%, 26% 100%, 54% 56%, 0 44%); }
.tirai::after {
content: ""; position: absolute; top: 50%; height: 3.4%; width: 62%;
background: repeating-linear-gradient(60deg, #e9b54c 0 4px, #b7832a 4px 7px); border-radius: 99px; box-shadow: 0 2px 3px rgba(0,0,0,.35);
}
.tirai-kiri::after { right: 4%; transform: rotate(-12deg); }
.tirai-kanan::after { left: 4%; transform: rotate(12deg); }
.ambang {
position: absolute; left: -6%; right: -6%; bottom: -5%; height: 7%;
background: linear-gradient(#8a5434, #5e3520);
border-radius: 4px;
box-shadow: 0 8px 12px rgba(0,0,0,.3);
z-index: 3;
}
.bintang circle { animation: kedip-bintang 3.2s ease-in-out infinite; }
.bintang circle:nth-child(2n) { animation-delay: -1.1s; animation-duration: 2.6s; }
.bintang circle:nth-child(3n) { animation-delay: -2.2s; animation-duration: 4s; }
@keyframes kedip-bintang { 50% { opacity: .25; } }
/* papan nama */
.papan {
position: absolute; right: 7%; top: 7%;
padding: .55em 1.1em .5em;
font-size: clamp(15px, 2.6vw, 26px);
font-weight: 800; letter-spacing: .02em;
color: #fff3d6;
background: linear-gradient(#a8693d, #7d4925);
border-radius: 10px;
box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.18), 0 10px 18px rgba(0,0,0,.28);
transform: rotate(-3deg);
text-shadow: 0 2px 0 rgba(60,25,8,.6);
}
.papan::before {
content: ""; position: absolute; left: 50%; top: -.95em; width: 1.9em; height: 1.9em; margin-left: -.95em;
transform: rotate(45deg);
border-left: 2px solid rgba(255,235,200,.6); border-top: 2px solid rgba(255,235,200,.6);
}
.papan::after {
content: ""; position: absolute; left: 50%; top: calc(-1.34em - 5px); width: 9px; height: 9px; margin-left: -4.5px;
border-radius: 50%; background: #d7d1c3; box-shadow: 0 1px 0 rgba(0,0,0,.4);
}
/* bohlam gantung */
.bohlam {
position: absolute; left: 61%; top: 0; width: 2px; height: 13vh;
background: #1a1410;
transform-origin: 50% 0;
animation: ayun 7s ease-in-out infinite alternate;
z-index: 1;
}
.bohlam i {
position: absolute; left: 50%; top: 100%; width: 26px; height: 32px; margin-left: -13px;
border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
background: radial-gradient(circle at 50% 60%, #fffbe8 0 22%, #ffe29a 50%, #f7b64e 100%);
box-shadow: 0 0 22px 8px rgba(255,214,140,.55), 0 0 80px 40px rgba(255,190,110,.18);
}
.bohlam i::before {
content: ""; position: absolute; left: 50%; top: -9px; width: 14px; height: 11px; margin-left: -7px;
border-radius: 3px; background: linear-gradient(90deg, #6b6158, #b4aa9c, #6b6158);
}
@keyframes ayun { from { transform: rotate(-2.2deg); } to { transform: rotate(2.2deg); } }
/* lantai, tikar, tanaman */
.lantai {
position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
background:
linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,0) 14%),
repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 118px, rgba(0,0,0,.22) 118px 121px),
linear-gradient(#6a4030, #4a2b1f);
border-top: 6px solid #3b2218;
}
.tikar {
position: absolute; left: 50%; bottom: 3%;
width: min(74vw, calc(var(--oyen-h) * 1.5)); height: calc(var(--oyen-h) * .2);
transform: translateX(-50%);
border-radius: 50%;
background:
repeating-linear-gradient(45deg, rgba(120,80,30,.18) 0 4px, rgba(0,0,0,0) 4px 8px),
repeating-linear-gradient(-45deg, rgba(255,240,200,.22) 0 4px, rgba(0,0,0,0) 4px 8px),
radial-gradient(ellipse at 50% 50%, #e7cd93 0 54%, #c23b32 54% 58%, #e7cd93 58% 64%, #3f8a4e 64% 68%, #d9bb7c 68%);
box-shadow: 0 6px 0 #9d7d48, 0 12px 20px rgba(0,0,0,.3);
}
.tanaman {
position: absolute; right: 4%; bottom: 7%;
height: min(54vh, 62vw); aspect-ratio: 160 / 300;
filter: drop-shadow(0 8px 10px rgba(0,0,0,.25));
}
.mangkok { position: absolute; left: 12%; bottom: 4%; width: min(22vh, 30vw); z-index: 3; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
/* Oyen */
.oyen {
position: absolute; left: 50%; bottom: 7.5%;
height: var(--oyen-h); aspect-ratio: 300 / 330;
transform: translateX(-50%);
padding: 0; margin: 0; border: 0; background: none;
cursor: pointer;
border-radius: 46%;
z-index: 4;
}
.oyen svg { display: block; width: 100
…