Becak Senja oleh @belajarweb

Becak mengayuh di jalan kota saat senja, dengan layangan, ruko bertenda, dan gunung di kejauhan. Tiap lapisan bergeser dengan kecepatan berbeda lewat…

Oleh @belajarweb · JavaScript

<!doctype html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Becak Senja</title>
<style>
:root { --s: 1; --krem: #fff1d6; --tinta: #2b1d33; }

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; background: #2b3566; }

body {
  font-family: "Avenir Next", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--krem);
  -webkit-tap-highlight-color: transparent;
}

.bp { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }

/* The world is 640 units tall, scaled to fit and pinned to the bottom edge. */
.bp-dunia {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(100vw / var(--s));
  height: 640px;
  transform: scale(var(--s));
  transform-origin: 0 100%;
}

.bp-langit {
  position: absolute;
  inset: -900px 0 auto;
  height: 1540px;
  background: linear-gradient(180deg, #1d2550 0%, #2b3566 38%, #4d4a8a 50%, #9a5f8f 60%,
    #e07f78 70%, #f7a66c 76%, #ffd08a 82%, #ffe7ad 86%, #ffd394 100%);
}

.bp-lapis { position: absolute; left: 0; top: 0; height: 640px; will-change: transform; }
.bp-lapis svg { display: block; overflow: visible; }

.bp-matahari i {
  position: absolute;
  left: calc(100vw / var(--s) * .66 - 300px);
  top: -36px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe9 0 50px, #fff0c2 54px, rgba(255, 214, 140, .75) 64px,
    rgba(255, 196, 120, .35) 120px, rgba(255, 170, 100, .12) 200px, transparent 300px);
}

/* a young moon, only tall screens see that high */
.bp-matahari b {
  position: absolute;
  left: calc(100vw / var(--s) * .8);
  top: -210px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: -8px 4px 0 #fff3cf;
  transform: rotate(-24deg);
}

.bp-cahaya {
  position: absolute;
  inset: 0 0 auto;
  height: 640px;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 66% 48%, rgba(255, 200, 120, .28), transparent 70%),
    linear-gradient(180deg, transparent 55%, rgba(255, 160, 90, .12) 80%, rgba(80, 40, 90, .2));
  mix-blend-mode: screen;
}

/* ---------- kites: the string sways from its far end, the kite rocks on top ---------- */

.bp-layang { transform-box: fill-box; transform-origin: 0 100%; animation: bp-layang 4.2s ease-in-out infinite alternate; }
.bp-layang-badan { transform-box: fill-box; transform-origin: 50% 40%; animation: bp-goyang-layang 1.9s ease-in-out infinite alternate; }
.bp-ekor { transform-box: fill-box; transform-origin: 50% 0; animation: bp-ekor 1.1s ease-in-out infinite alternate; }
g:nth-child(2n) > .bp-layang { animation-duration: 3.4s; animation-delay: -1.3s; }
g:nth-child(3n) > .bp-layang { animation-duration: 5s; animation-delay: -2.6s; }
g:nth-child(2n) > .bp-layang > .bp-layang-badan { animation-duration: 1.5s; animation-delay: -.7s; }

@keyframes bp-layang { from { transform: rotate(-2deg); } to { transform: rotate(2.2deg); } }
@keyframes bp-goyang-layang { from { transform: rotate(-9deg); } to { transform: rotate(8deg); } }
@keyframes bp-ekor { from { transform: skewX(-14deg); } to { transform: skewX(14deg); } }

.bp-bintang { animation: bp-kedip 2.4s ease-in-out infinite; }
@keyframes bp-kedip { 50% { opacity: .35; } }

/* ---------- shops and the street lamp ---------- */

.bp-lapis text {
  font-family: "Arial Narrow", "Avenir Next Condensed", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-weight: 800;
  text-anchor: middle;
  letter-spacing: .04em;
}

.bp-lampu-jalan { animation: bp-lampu 3s ease-in-out infinite alternate; }
@keyframes bp-lampu { to { opacity: .7; } }

/* ---------- the becak ---------- */

.bp-becak { position: absolute; top: 362px; overflow: visible; will-change: transform; }

.bp-ban { fill: none; stroke: #1c1622; stroke-width: 7; }
.bp-velg { fill: none; stroke: #d9cfc0; stroke-width: 2.5; }
.bp-jari line { stroke: #e9e0d2; stroke-width: 1.1; }
.bp-as { fill: #f2c14e; stroke: #8a6a20; stroke-width: 1.5; }
.bp-spakbor { fill: none; stroke: #c8352b; stroke-width: 5; stroke-linecap: round; }
.bp-engkol { stroke: #b9b4c2; stroke-width: 4.5; stroke-linecap: round; }
.bp-paha, .bp-betis { fill: none; stroke-linecap: round; }
.bp-paha { stroke: #3b3a5c; stroke-width: 15; }
.bp-betis { stroke: #9a5d36; stroke-width: 10; }
.bp-sandal { fill: #d64a3a; }
.bp-jauh .bp-paha { stroke: #2a2944; }
.bp-jauh .bp-betis { stroke: #7a4728; }
.bp-jauh .bp-sandal { fill: #9e3328; }
.bp-engkol.bp-jauh { stroke: #6f6a78; }
.bp-mata { fill: #2b1d33; }
.bp-senyum { fill: none; stroke: #2b1d33; stroke-width: 1.6; stroke-linecap: round; }
.bp-lampu { fill: #ffe9a0; stroke: #8f2219; stroke-width: 2; filter: drop-shadow(0 0 6px #ffd27a); }

.bp-kring { opacity: 0; transform-box: fill-box; transform-origin: 20% 100%; transform: scale(.4); }
.bp-kring path { fill: #fff1d6; stroke: #2b1d33; stroke-width: 2.5; }
.bp-kring text { font-weight: 800; font-size: 17px; fill: #c8352b; text-anchor: middle; }
.bp-kring.bp-bunyi { animation: bp-kring 1.4s cubic-bezier(.2, .9, .3, 1.2); }

@keyframes bp-kring {
  0% { opacity: 0; transform: scale(.4) rotate(-8deg); }
  15% { opacity: 1; transform: scale(1.06) rotate(3deg); }
  25% { transform: scale(1) rotate(-2deg); }
  80% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(.9) translateY(-8px); }
}

/* ---------- title and controls ---------- */

.bp-kepala { position: absolute; left: 28px; top: 24px; max-width: calc(100vw - 56px); text-shadow: 0 2px 12px rgba(60, 20, 60, .45); }
.bp-kepala h1 { margin: 0; font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; letter-spacing: -.01em; line-height: 1; color: #fff4dc; }
.bp-sub { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: #ffe2b8; }
.bp-sub-sentuh { display: none; }

@media (hover: none) {
  .bp-sub-kursor { display: none; }
  .bp-sub-sentuh { display: block; }
}

.bp-kendali {
  position: absolute;
 
…

Karya lain di Galeri