feat(theme): replace meteor and star visuals with Italian night sky
- Update star background colors to warmer cream tones matching the food palette - Convert meteors into meatballs with randomized sauce variants, trail/ball/splatter layers, and responsive sizing via CSS variables - Rename and restyle twinkling stars as parmesan flecks, updating IDs and docs for visual consistency
This commit is contained in:
1 parent
6de79d25e4
commit
bbb76eaa31
5 files changed
+207
-79
No files matched your search
+2
-2
@@ -8,9 +8,9 @@
|
||||
}
|
||||
|
||||
function generateStars(n) {
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #fff`;
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #FFF6E5`;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #fff`;
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #F5E6D3`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
---
|
||||
/**
|
||||
* Meteors.astro
|
||||
* This component creates meteors that are appended to the galaxy on interval.
|
||||
* Meteors are removed from the document after the animation is completed.
|
||||
* There are four (4) meteor shower containers, one for each diagonal direction.
|
||||
* MeatballShower.astro
|
||||
* This component creates shooting meatballs that are appended to the galaxy on interval.
|
||||
* Each streak is a trail of marinara with a meatball at the head. Meatballs are removed from
|
||||
* the document after the animation is completed.
|
||||
* There are four (4) shower containers, one for each diagonal direction.
|
||||
*/
|
||||
---
|
||||
|
||||
<div id="meteors">
|
||||
<!-- rotations defined in base.css & tailwind.config.mjs -->
|
||||
<div id="meatballs">
|
||||
<!-- rotations defined in global.css -->
|
||||
<div class="shower ur" />
|
||||
<div class="shower dr" />
|
||||
<div class="shower dl" />
|
||||
@@ -16,27 +17,47 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function createMeteor () {
|
||||
// create a meteor
|
||||
let meteor = document.createElement("div");
|
||||
meteor.setAttribute("class", "meteor");
|
||||
meteor.style.left = Math.round(Math.random() * window.innerWidth) + "px";
|
||||
meteor.style.top = Math.round(Math.random() * window.innerHeight) + "px";
|
||||
|
||||
// append the meteor to a random meteor shower (direction)
|
||||
const showers = document.querySelectorAll(".shower");
|
||||
const sauceVariants = ["v1", "v2", "v3"];
|
||||
|
||||
function randomInt(min: number, max: number) {
|
||||
return Math.round(Math.random() * (max - min) + min);
|
||||
}
|
||||
|
||||
function createMeatball () {
|
||||
// create a meatball with a randomized size and sauce pattern
|
||||
let meatball = document.createElement("div");
|
||||
const sauceVariant = sauceVariants[Math.floor(Math.random() * sauceVariants.length)];
|
||||
meatball.setAttribute("class", `meatball ${sauceVariant}`);
|
||||
meatball.style.left = Math.round(Math.random() * window.innerWidth) + "px";
|
||||
meatball.style.top = Math.round(Math.random() * window.innerHeight) + "px";
|
||||
|
||||
// the ball and its marinara trail are smaller on phones
|
||||
const isSmall = window.innerWidth < 768;
|
||||
meatball.style.setProperty("--ball-size", `${randomInt(isSmall ? 7 : 9, isSmall ? 10 : 14)}px`);
|
||||
meatball.style.setProperty("--trail-length", `${randomInt(isSmall ? 22 : 30, isSmall ? 34 : 45)}vh`);
|
||||
meatball.style.setProperty("--trail-width", `${randomInt(isSmall ? 9 : 12, isSmall ? 14 : 18)}px`);
|
||||
|
||||
// the marinara trail, the meatball at its head, and the droplets flung behind it
|
||||
for (const layer of ["trail", "ball", "splatter"]) {
|
||||
const el = document.createElement("span");
|
||||
el.setAttribute("class", layer);
|
||||
meatball.append(el);
|
||||
}
|
||||
|
||||
// append the meatball to a random shower (direction)
|
||||
const showers = document.querySelectorAll("#meatballs .shower");
|
||||
if (showers.length > 0) {
|
||||
const random = Math.floor(Math.random() * showers.length);
|
||||
const shower = showers[random];
|
||||
shower.append(meteor);
|
||||
shower.append(meatball);
|
||||
}
|
||||
|
||||
// remove the meteor after the animation duration
|
||||
// remove the meatball after the animation duration
|
||||
setTimeout(() => {
|
||||
meteor.remove();
|
||||
meatball.remove();
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
// Create meteors on interval on two (2) seconds
|
||||
setInterval(createMeteor, 1500);
|
||||
// Create meatballs on interval on 1.5 seconds
|
||||
setInterval(createMeatball, 1500);
|
||||
</script>
|
||||
@@ -1,14 +1,14 @@
|
||||
---
|
||||
/**
|
||||
* TwinkleStars.astro
|
||||
* This component creates twinkling stars that are appended to the galaxy on interval.
|
||||
* Twinkle stars are removed from the document after the animation is completed.
|
||||
* ParmesanFlecks.astro
|
||||
* This component creates flecks of parmesan that twinkle in the night sky and are appended to
|
||||
* the galaxy on interval. Flecks are removed from the document after the animation is completed.
|
||||
* The svg below is just a template for the script to clone and append to the galaxy.
|
||||
*/
|
||||
---
|
||||
|
||||
<svg
|
||||
id="twinkle-star"
|
||||
id="parmesan-fleck"
|
||||
class="template"
|
||||
width="149"
|
||||
height="149"
|
||||
@@ -17,46 +17,42 @@
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="absolute left-full animate-twinkle"
|
||||
>
|
||||
<circle cx="74" cy="74" r="11" fill="white"/>
|
||||
<rect y="141.421" width="200" height="10" transform="rotate(-45 0 141.421)" fill="url(#paint0_linear_4_2)"/>
|
||||
<rect x="7.07107" width="200" height="10" transform="rotate(45 7.07107 0)" fill="url(#paint1_linear_4_2)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_4_2" x1="0" y1="146.421" x2="200" y2="146.421" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1E1E1E"/>
|
||||
<stop offset="0.445" stop-color="white"/>
|
||||
<stop offset="0.58721" stop-color="white"/>
|
||||
<stop offset="1" stop-color="#1E1E1E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_4_2" x1="7.07107" y1="5" x2="207.071" y2="5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1E1E1E"/>
|
||||
<stop offset="0.42" stop-color="white"/>
|
||||
<stop offset="0.555" stop-color="white"/>
|
||||
<stop offset="1" stop-color="#1E1E1E"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="fleck_glow_4_2" cx="74" cy="74" r="70" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FFF6E5"/>
|
||||
<stop offset="0.45" stop-color="#F5E6D3"/>
|
||||
<stop offset="1" stop-color="#F5E6D3" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<!-- the soft glow of the fleck catching the light -->
|
||||
<circle cx="74" cy="74" r="66" fill="url(#fleck_glow_4_2)" opacity="0.22"/>
|
||||
<!-- the grate's offcuts: one pale irregular shard, two smaller chips -->
|
||||
<path d="M48 40 L96 42 L108 76 L74 102 L44 84 L36 56 Z" fill="#FFF6E5"/>
|
||||
<path d="M110 28 L130 34 L124 54 L104 46 Z" fill="#F5E6D3" opacity="0.8"/>
|
||||
<path d="M28 96 L50 104 L42 124 L24 112 Z" fill="#F5E6D3" opacity="0.6"/>
|
||||
</svg>
|
||||
|
||||
<script is:inline>
|
||||
// Generate a twinkle star and append it to the galaxy, remove it after animation.
|
||||
function generateTwinkleStar() {
|
||||
const twinkleStarTemplate = document.getElementById("twinkle-star")
|
||||
if (!twinkleStarTemplate) { return; }
|
||||
// Clone the twinkle star template and set its attributes.
|
||||
const twinkleStar = twinkleStarTemplate.cloneNode(true);
|
||||
twinkleStar.style.position = "absolute";
|
||||
twinkleStar.style.left = Math.floor(Math.random() * window.innerWidth) + "px";
|
||||
twinkleStar.style.top = Math.floor(Math.random() * (window.innerHeight/3)) + "px";
|
||||
twinkleStar.style.width = window.innerWidth < 768 ? Math.floor(Math.random() * (15 - 7.5 + 1) + 7.5) : Math.floor(Math.random() * (30 - 15 + 1) + 15) + "px";
|
||||
twinkleStar.style.height = twinkleStar.style.width;
|
||||
twinkleStar.classList.add("twinkle");
|
||||
document.getElementById("galaxy").appendChild(twinkleStar);
|
||||
// Generate a parmesan fleck and append it to the galaxy, remove it after animation.
|
||||
function generateParmesanFleck() {
|
||||
const fleckTemplate = document.getElementById("parmesan-fleck")
|
||||
if (!fleckTemplate) { return; }
|
||||
// Clone the parmesan fleck template and set its attributes.
|
||||
const fleck = fleckTemplate.cloneNode(true);
|
||||
fleck.style.position = "absolute";
|
||||
fleck.style.left = Math.floor(Math.random() * window.innerWidth) + "px";
|
||||
fleck.style.top = Math.floor(Math.random() * (window.innerHeight/3)) + "px";
|
||||
fleck.style.width = (window.innerWidth < 768 ? Math.floor(Math.random() * (15 - 7.5 + 1) + 7.5) : Math.floor(Math.random() * (30 - 15 + 1) + 15)) + "px";
|
||||
fleck.style.height = fleck.style.width;
|
||||
fleck.classList.add("fleck");
|
||||
document.getElementById("galaxy").appendChild(fleck);
|
||||
|
||||
// Remove the twinkle star after the animation is completed.
|
||||
// Remove the fleck after the animation is completed.
|
||||
setTimeout(() => {
|
||||
twinkleStar.remove();
|
||||
fleck.remove();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
setInterval(generateTwinkleStar, 5000);
|
||||
setInterval(generateParmesanFleck, 5000);
|
||||
</script>
|
||||
|
||||
@@ -5,8 +5,8 @@ import ArrowCard from "@components/ArrowCard"
|
||||
import StackCard from "@components/StackCard.astro"
|
||||
import { SITE, SOCIALS } from "@consts"
|
||||
import { byDateDesc, toSearchEntry } from "@lib/content"
|
||||
import TwinklingStars from "@components/TwinklingStars.astro"
|
||||
import MeteorShower from "@components/MeteorShower.astro"
|
||||
import ParmesanFlecks from "@components/ParmesanFlecks.astro"
|
||||
import MeatballShower from "@components/MeatballShower.astro"
|
||||
|
||||
const allBlogEntries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
const posts = allBlogEntries
|
||||
@@ -60,11 +60,11 @@ const stack = [
|
||||
<div id='stars3' class='fixed inset-0'></div>
|
||||
</div>
|
||||
|
||||
<!-- Dark Theme: Twinkling Stars / Meteor Shower -->
|
||||
<!-- Dark Theme: Parmesan Flecks / Meatball Shower -->
|
||||
<div id="galaxy" class="fixed inset-0">
|
||||
<div class="hidden dark:block">
|
||||
<TwinklingStars/>
|
||||
<MeteorShower/>
|
||||
<ParmesanFlecks/>
|
||||
<MeatballShower/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+128
-17
@@ -15,8 +15,17 @@
|
||||
--color-spaghetti-dark-red: #FCA5A5;
|
||||
--color-spaghetti-dark-yellow: #FCD34D;
|
||||
|
||||
/* Sauce, meat and parmesan for the dark-mode sky. */
|
||||
--color-marinara: #E23B2C;
|
||||
--color-marinara-dark: #B3261E;
|
||||
--color-meatball: #A05A2E;
|
||||
--color-meatball-mid: #6B3418;
|
||||
--color-meatball-dark: #34190C;
|
||||
--color-parmesan: #FFF6E5;
|
||||
|
||||
--animate-twinkle: twinkle 2s ease-in-out forwards;
|
||||
--animate-meteor: meteor 3s ease-in-out forwards;
|
||||
--animate-meatball: meatball 3s ease-in-out forwards;
|
||||
--animate-tumble: meatball-tumble 1.4s linear infinite;
|
||||
|
||||
@keyframes twinkle {
|
||||
0% { opacity: 0; transform: rotate(0deg); }
|
||||
@@ -24,11 +33,17 @@
|
||||
100% { opacity: 0; transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@keyframes meteor {
|
||||
/* Streak travels up its own length (head of the meatball leads, sauce trails). */
|
||||
@keyframes meatball {
|
||||
0% { opacity: 0; transform: translateY(200%); }
|
||||
50% { opacity: 1; }
|
||||
100% { opacity: 0; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes meatball-tumble {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(200deg); }
|
||||
}
|
||||
}
|
||||
|
||||
:root{
|
||||
@@ -313,47 +328,143 @@ article img {
|
||||
}
|
||||
|
||||
/**
|
||||
* TWINKLE STARS
|
||||
* PARMESAN FLECKS
|
||||
*/
|
||||
|
||||
#twinkle-star.template {
|
||||
#parmesan-fleck.template {
|
||||
@apply absolute -left-full; /* hide offscreen */
|
||||
}
|
||||
|
||||
#twinkle-star.twinkle {
|
||||
@apply animate-twinkle; /* defined in tailwind.config */
|
||||
#parmesan-fleck.fleck {
|
||||
@apply animate-twinkle; /* defined in @theme above */
|
||||
filter: drop-shadow(0 0 3px color-mix(in srgb, var(--color-parmesan) 55%, transparent));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Meteors
|
||||
* Meatballs — shooting meatballs on trails of marinara
|
||||
* The wrapper is the streak: its head (top edge) is the meatball, the sauce trails below it.
|
||||
*/
|
||||
|
||||
#meteors .shower {
|
||||
@apply absolute inset-0 top-0;;
|
||||
#meatballs .shower {
|
||||
@apply absolute inset-0 top-0;
|
||||
@apply left-1/2 -translate-x-1/2;
|
||||
@apply w-screen aspect-square;
|
||||
}
|
||||
|
||||
#meteors .meteor {
|
||||
@apply animate-meteor; /* defined in tailwind.config */
|
||||
@apply absolute top-1/2 left-1/2 w-px h-[75vh];
|
||||
@apply bg-gradient-to-b from-white to-transparent;
|
||||
#meatballs .meatball {
|
||||
@apply animate-meatball; /* defined in @theme above */
|
||||
@apply absolute top-1/2 left-1/2;
|
||||
/* --trail-length / --trail-width / --ball-size are set per instance by the script. */
|
||||
width: var(--trail-width, 16px);
|
||||
height: var(--trail-length, 40vh);
|
||||
}
|
||||
|
||||
#meteors .shower.ur {
|
||||
#meatballs .trail {
|
||||
@apply absolute left-1/2 top-0;
|
||||
width: var(--trail-width, 16px);
|
||||
height: 100%;
|
||||
transform: translateX(-50%);
|
||||
background: linear-gradient(to bottom,
|
||||
var(--color-marinara) 0%,
|
||||
var(--color-marinara-dark) 45%,
|
||||
transparent 100%);
|
||||
clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
|
||||
filter: blur(1.2px);
|
||||
opacity: .85;
|
||||
}
|
||||
|
||||
/* Bright, freshly sauced core right under the meatball. */
|
||||
#meatballs .trail::after {
|
||||
content: "";
|
||||
@apply absolute inset-0;
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(255, 112, 86, .85) 0%,
|
||||
rgba(226, 59, 44, .3) 30%,
|
||||
transparent 62%);
|
||||
clip-path: polygon(32% 0, 68% 0, 55% 100%, 45% 100%);
|
||||
}
|
||||
|
||||
/* Anchor for the sphere; keeps the lighting fixed while the texture tumbles. */
|
||||
#meatballs .ball {
|
||||
@apply absolute left-1/2 top-0;
|
||||
width: var(--ball-size, 12px);
|
||||
height: var(--ball-size, 12px);
|
||||
transform: translate(-50%, -50%);
|
||||
overflow: hidden;
|
||||
border-radius: 46% 54% 51% 49% / 53% 47% 55% 45%; /* hand-rolled, never a perfect sphere */
|
||||
background:
|
||||
radial-gradient(circle at 31% 27%, color-mix(in srgb, var(--color-meatball) 15%, #FFD6AA) 0 9%, transparent 44%),
|
||||
radial-gradient(circle at 72% 76%, rgba(0, 0, 0, .42) 0 26%, transparent 60%),
|
||||
radial-gradient(circle at 50% 45%, var(--color-meatball) 0 40%, var(--color-meatball-mid) 72%, var(--color-meatball-dark) 100%);
|
||||
box-shadow:
|
||||
inset -1px -2px 3px rgba(20, 8, 4, .8),
|
||||
inset 2px 2px 3px rgba(255, 200, 150, .16),
|
||||
0 0 7px color-mix(in srgb, var(--color-marinara) 50%, transparent);
|
||||
}
|
||||
|
||||
/* Seared crumb texture, rotating so the meatball looks like it tumbles in flight. */
|
||||
#meatballs .ball::after {
|
||||
content: "";
|
||||
@apply absolute inset-0;
|
||||
border-radius: inherit;
|
||||
background:
|
||||
radial-gradient(circle at 62% 34%, rgba(35, 16, 8, .75) 0 7%, transparent 8%),
|
||||
radial-gradient(circle at 34% 62%, rgba(35, 16, 8, .65) 0 6%, transparent 7%),
|
||||
radial-gradient(circle at 55% 70%, rgba(140, 88, 52, .55) 0 5%, transparent 6%),
|
||||
radial-gradient(circle at 22% 38%, rgba(140, 88, 52, .5) 0 4%, transparent 5%);
|
||||
animation: var(--animate-tumble);
|
||||
}
|
||||
|
||||
/* Sauce droplets flung to the sides of the stream. Offsets are fractions of the trail, so they
|
||||
stay put however long or wide a streak is. The dot itself is invisible; only shadows are drawn. */
|
||||
#meatballs .splatter {
|
||||
@apply absolute left-1/2 top-0 rounded-full;
|
||||
--spray: max(11px, calc(var(--trail-width, 16px) * 1.1));
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
background: transparent;
|
||||
opacity: .8;
|
||||
filter: blur(.35px);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v1 .splatter {
|
||||
box-shadow:
|
||||
calc(var(--spray) * -1) calc(var(--trail-length, 40vh) * .3) 0 -1px var(--color-marinara),
|
||||
var(--spray) calc(var(--trail-length, 40vh) * .48) 0 -.5px var(--color-marinara-dark),
|
||||
calc(var(--spray) * -1.5) calc(var(--trail-length, 40vh) * .66) 0 -.5px rgba(179, 38, 30, .7),
|
||||
calc(var(--spray) * 1.2) calc(var(--trail-length, 40vh) * .84) 0 -1px rgba(226, 59, 44, .5);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v2 .splatter {
|
||||
box-shadow:
|
||||
var(--spray) calc(var(--trail-length, 40vh) * .26) 0 -.5px var(--color-marinara-dark),
|
||||
calc(var(--spray) * -1.3) calc(var(--trail-length, 40vh) * .44) 0 -1px var(--color-marinara),
|
||||
calc(var(--spray) * 1.6) calc(var(--trail-length, 40vh) * .62) 0 -.5px rgba(179, 38, 30, .65),
|
||||
calc(var(--spray) * -1.1) calc(var(--trail-length, 40vh) * .86) 0 -.5px rgba(226, 59, 44, .45);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v3 .splatter {
|
||||
box-shadow:
|
||||
calc(var(--spray) * -1.6) calc(var(--trail-length, 40vh) * .34) 0 -1px var(--color-marinara-dark),
|
||||
calc(var(--spray) * 1.2) calc(var(--trail-length, 40vh) * .5) 0 -.5px var(--color-marinara),
|
||||
calc(var(--spray) * 1.05) calc(var(--trail-length, 40vh) * .7) 0 -1px rgba(179, 38, 30, .6),
|
||||
calc(var(--spray) * -1.35) calc(var(--trail-length, 40vh) * .9) 0 -1.5px rgba(226, 59, 44, .4);
|
||||
}
|
||||
|
||||
#meatballs .shower.ur {
|
||||
@apply rotate-45;
|
||||
}
|
||||
|
||||
#meteors .shower.dr {
|
||||
#meatballs .shower.dr {
|
||||
@apply rotate-135;
|
||||
}
|
||||
|
||||
#meteors .shower.dl {
|
||||
#meatballs .shower.dl {
|
||||
@apply rotate-225;
|
||||
}
|
||||
|
||||
#meteors .shower.ul {
|
||||
#meatballs .shower.ul {
|
||||
@apply rotate-315;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user