<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fluri Blog]]></title><description><![CDATA[Themes for your website!]]></description><link>https://fluri.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 22:10:59 GMT</lastBuildDate><atom:link href="https://fluri.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Three ways to destroy a web page and put it back exactly]]></title><description><![CDATA[A 404 page is the one place where you're allowed to be silly. I made three small packages that let visitors wreck the page they are on: a black hole that…]]></description><link>https://fluri.hashnode.dev/three-ways-to-destroy-a-web-page-and-put-it-back-exactly</link><guid isPermaLink="true">https://fluri.hashnode.dev/three-ways-to-destroy-a-web-page-and-put-it-back-exactly</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Fri, 04 Dec 2026 13:26:10 GMT</pubDate><content:encoded><![CDATA[<p>A 404 page is the one place where you're allowed to be silly. I made three small packages that let visitors wreck the page they are on: a <strong>black hole</strong> that swallows it, a <strong>spaceship</strong> that shoots it to bits, and a <strong>snap</strong> that turns half of it to dust. Each one has a "Put it back" button, and that button was the hard part.</p>
<p><img src="https://fluri.xyz/previews/npm/v2/black-hole.png" alt="Black Hole by Fluri: a black hole pulling in a web page" /></p>
<p><strong>Try them:</strong> <a href="https://fluri.xyz/black-hole/">https://fluri.xyz/black-hole/</a> · <a href="https://fluri.xyz/page-asteroids/">https://fluri.xyz/page-asteroids/</a> · <a href="https://fluri.xyz/page-snap/">https://fluri.xyz/page-snap/</a></p>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/black-hole@1/dist/black-hole.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<p>All three are free, MIT and have zero dependencies. They start from a small button, the Konami code, a timer or your own code.</p>
<h2>Rule one: never touch the layout</h2>
<p>If you remove or move real elements, the page reflows, things jump, and you can't promise to restore it. So the page is only ever changed with <code>transform</code>, <code>opacity</code>, <code>clip-path</code> and <code>visibility</code>, which don't affect layout. Before anything starts, each piece's own inline values for those properties are saved, and "Put it back" writes them back.</p>
<h2>Choosing the pieces</h2>
<p>The pieces are headings, paragraphs, images, buttons, list items and cards that are on screen. Three checks keep it sane:</p>
<ul>
<li><strong>Never a piece inside another piece</strong>, or a card and its heading would fly apart.</li>
<li><strong>Nothing fixed or sticky</strong>, and nothing that covers more than about a third of the screen.</li>
<li><strong>For text, measure the words</strong> with a <code>Range</code>, not the element. A heading's box is as wide as the page; the words are not.</li>
</ul>
<h2>Three ways to go</h2>
<p><strong>Black hole.</strong> The nearest pieces go first. Each gets a pull toward the hole plus a sideways push, so it spirals in, and it shrinks and spins faster as it gets close. The hole grows as it eats.</p>
<p><strong>Asteroids.</strong> A ship flies over the page; every laser is a point checked against each piece's rectangle. While playing, clicks are stopped in the capture phase so nobody follows a link by accident.</p>
<p><strong>Snap.</strong> Random pieces are wiped away with an animated <code>clip-path: inset()</code> while dust is emitted along the moving edge. The dust lives in one <code>Float32Array</code>, eight numbers per speck, so thousands of specks create no garbage. Images are sampled on a tiny canvas for their colours; if the image comes from another site without CORS, reading it throws, so that's wrapped in a <code>try</code> and the dust falls back to one colour.</p>
<p>For <code>prefers-reduced-motion</code>, the black hole and the snap become a calm fade, and the game drops its flying debris.</p>
<hr />
<p>They're part of <a href="https://fluri.xyz/">Fluri</a>, my collection of interactive website effects. The npm packages are free; there's a no-code version for WordPress, Shopify and Wix.</p>
<p>Which one would you put on your 404 page?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/black-hole">https://www.npmjs.com/package/@fluritheme/black-hole</a> · <a href="https://www.npmjs.com/package/@fluritheme/page-asteroids">https://www.npmjs.com/package/@fluritheme/page-asteroids</a> · <a href="https://www.npmjs.com/package/@fluritheme/page-snap">https://www.npmjs.com/package/@fluritheme/page-snap</a></p>
]]></content:encoded></item><item><title><![CDATA[Googly eyes for any element with one attribute (and the spring that makes them wobble)]]></title><description><![CDATA[Some ideas don't need a business case. I wanted to put googly eyes on a logo, so I made Googly Eyes: add one attribute to anything and it gets a pair of…]]></description><link>https://fluri.hashnode.dev/googly-eyes-for-any-element-with-one-attribute-and-the-spring-that-makes-them-wobble</link><guid isPermaLink="true">https://fluri.hashnode.dev/googly-eyes-for-any-element-with-one-attribute-and-the-spring-that-makes-them-wobble</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[CSS]]></category><category><![CDATA[animation]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Fri, 04 Dec 2026 13:25:53 GMT</pubDate><content:encoded><![CDATA[<p>Some ideas don't need a business case. I wanted to put googly eyes on a logo, so I made <strong>Googly Eyes</strong>: add one attribute to anything and it gets a pair of eyes that follow the cursor. Free, MIT, zero dependencies, about 11 KB.</p>
<p><img src="https://fluri.xyz/previews/npm/v2/googly-eyes.png" alt="Googly Eyes by Fluri: googly eyes sitting on website elements" /></p>
<p><strong>Live demo:</strong> <a href="https://fluri.xyz/googly-eyes/">https://fluri.xyz/googly-eyes/</a></p>
<pre><code class="language-html">&lt;img src="logo.svg" data-googly&gt;
&lt;h1 data-googly&gt;Hello&lt;/h1&gt;
&lt;img src="team.jpg" data-googly="42,30"&gt; &lt;!-- 42% across, 30% down --&gt;

&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/googly-eyes@1/dist/googly-eyes.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<h2>Eyes that only look are boring</h2>
<p>My first version pointed the pupils at the cursor. It worked and it was dull. Real googly eyes are funny because the pupil is a loose disc that overshoots, hits the rim and rattles.</p>
<p>So each pupil is a small physics object on a loose spring:</p>
<pre><code class="language-js">vx += ((targetX - x) * k - vx * c) * dt;
vy += ((targetY - y) * k - vy * c) * dt;
x += vx * dt;
y += vy * dt;
</code></pre>
<p><code>k</code> pulls the pupil toward where it should look and <code>c</code> slows it down. With little damping the pupil swings past the target and wobbles back. When it leaves the circle it is put back on the rim and the part of its speed that points outward is reflected, so it bounces:</p>
<pre><code class="language-js">const vn = vx * nx + vy * ny; // speed toward the rim
if (vn &gt; 0) { vx -= 1.55 * vn * nx; vy -= 1.55 * vn * ny; }
</code></pre>
<p>Scrolling adds a kick to the vertical speed, so the eyes rattle when the page moves. A click near a pair shakes it. And when nobody has moved for a couple of seconds, the pupils droop and glance around now and then.</p>
<h2>Nothing in your layout changes</h2>
<p>The eyes are not inserted next to your element. They live in one fixed layer on top of the page with <code>pointer-events: none</code>, and every frame each pair is moved to its element's <code>getBoundingClientRect()</code>. No wrappers, no changed images, and removing the script removes everything.</p>
<p>Sizing took a few tries. On a picture, the eyes scale with the picture. On words, they are about the size of the letters and sit on the first line. To find where the words really are, and not the full-width box of the heading, I measure a <code>Range</code> over the text.</p>
<p>It respects <code>prefers-reduced-motion</code> (the eyes still look, without the wobble) and picks up elements added later.</p>
<hr />
<p>It's part of <a href="https://fluri.xyz/">Fluri</a>, my collection of playful website effects. The npm packages are free; there's a no-code version for WordPress, Shopify and Wix.</p>
<p>What would you put eyes on first?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/googly-eyes">https://www.npmjs.com/package/@fluritheme/googly-eyes</a></p>
]]></content:encoded></item><item><title><![CDATA[I put a real fluid simulation behind the cursor (16 KB, no dependencies)]]></title><description><![CDATA[You know the effect: the cursor drags coloured smoke behind it, and the smoke curls and mixes like ink in water. Most versions I found are tied to React or…]]></description><link>https://fluri.hashnode.dev/i-put-a-real-fluid-simulation-behind-the-cursor-16-kb-no-dependencies</link><guid isPermaLink="true">https://fluri.hashnode.dev/i-put-a-real-fluid-simulation-behind-the-cursor-16-kb-no-dependencies</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[animation]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Fri, 04 Dec 2026 13:25:27 GMT</pubDate><content:encoded><![CDATA[<p>You know the effect: the cursor drags coloured smoke behind it, and the smoke curls and mixes like ink in water. Most versions I found are tied to React or pull in a 3D library. I wanted one script tag, so I wrote <strong>Fluid Cursor</strong>: free, MIT, zero dependencies, about 16 KB minified.</p>
<p><img src="https://fluri.xyz/previews/npm/v2/fluid-cursor.png" alt="Fluid Cursor by Fluri: coloured smoke following the cursor" /></p>
<p><strong>Live demo:</strong> <a href="https://fluri.xyz/fluid-cursor/">https://fluri.xyz/fluid-cursor/</a></p>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/fluid-cursor@1/dist/fluid-cursor.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<p>Or with npm:</p>
<pre><code class="language-js">import { createFluidCursor } from "@fluritheme/fluid-cursor";

const fluid = createFluidCursor({ colors: ["#ff3d7f", "#7c4dff", "#22d3ee"], fade: 2.5 });
fluid.splash(); // a splash in the middle of the screen
</code></pre>
<h2>It is a real simulation</h2>
<p>Every frame runs the classic "stable fluids" steps on the graphics card, each one a small fragment shader drawing into a texture:</p>
<ol>
<li><strong>Curl and vorticity</strong>: measure how much the liquid spins, then push that spin back in, so small swirls don't die out.</li>
<li><strong>Divergence and pressure</strong>: 18 rounds of a simple solver work out the pressure that keeps the liquid from piling up.</li>
<li><strong>Subtract the pressure gradient</strong>, which leaves a flow that neither creates nor loses liquid.</li>
<li><strong>Advect</strong>: move the velocity and the colour along the flow.</li>
</ol>
<p>The cursor only adds two things: a small push in the direction it moved, and a blob of colour.</p>
<h2>Three things that made it usable on a real page</h2>
<p><strong>Velocity is cheap, colour is sharp.</strong> The velocity grid is 128 cells on the short side. The colour is drawn at 640 (384 on small screens). You can't see low-resolution velocity, but you can see low-resolution colour.</p>
<p><strong>See-through output.</strong> The canvas sits on top of the page with <code>pointer-events: none</code>. The last shader writes premultiplied colour and uses the brightest channel as alpha, so the smoke floats over dark and light pages and never blocks a click.</p>
<p><strong>It stops.</strong> A few seconds after the last movement, when the colour has faded, the loop stops and the canvas is cleared. At rest it costs nothing.</p>
<h2>The bug that cost me an hour</h2>
<p>On one machine nothing was drawn and there was no error. The link log said: <em>Precisions of uniform 'texel' differ between VERTEX and FRAGMENT shaders.</em> My vertex shader was <code>highp</code>, my fragment shaders <code>mediump</code>, and one uniform was used in both. Declaring it <code>highp</code> in the fragment shader fixed it. If your WebGL program fails to link without a word, read <code>getProgramInfoLog</code>.</p>
<p>It uses WebGL 2 with half-float textures and falls back to WebGL 1. Where neither works it does nothing, and it stays off for <code>prefers-reduced-motion</code>.</p>
<hr />
<p>It's part of <a href="https://fluri.xyz/">Fluri</a>, my collection of interactive website effects. The npm packages are free; there's a no-code version for WordPress, Shopify and Wix.</p>
<p>How does it run on your machine? I'd like to hear about older phones especially.</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/fluid-cursor">https://www.npmjs.com/package/@fluritheme/fluid-cursor</a></p>
]]></content:encoded></item><item><title><![CDATA[I made a 9 KB northern lights background for any website (no WebGL)]]></title><description><![CDATA[Aurora backgrounds are everywhere right now. Most of the ones I found are either a blurred CSS gradient that never really looks like an aurora, or a WebGL…]]></description><link>https://fluri.hashnode.dev/i-made-a-9-kb-northern-lights-background-for-any-website-no-webgl</link><guid isPermaLink="true">https://fluri.hashnode.dev/i-made-a-9-kb-northern-lights-background-for-any-website-no-webgl</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[CSS]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Fri, 04 Dec 2026 09:12:21 GMT</pubDate><content:encoded><![CDATA[<p>Aurora backgrounds are everywhere right now. Most of the ones I found are either a blurred CSS gradient that never really looks like an aurora, or a WebGL shader that pulls in a whole library.</p>
<p>I wanted something in between: real curtains of light that shimmer and drift, that you add with one script tag, and that don't make a laptop fan spin up. So I built <strong>Aurora</strong>, a free MIT package with zero dependencies, about 9 KB minified.</p>
<p><img src="https://fluri.xyz/previews/npm/aurora.png" alt="Aurora by Fluri: northern lights over a website header" /></p>
<p><strong>Live demo:</strong> <a href="https://fluri.xyz/aurora/">https://fluri.xyz/aurora/</a></p>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/aurora@1/dist/aurora.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<p>Or with npm:</p>
<pre><code class="language-js">import { createAurora } from "@fluritheme/aurora";

const aurora = createAurora({ palette: "classic", height: 0.6 });
aurora.pulse();        // a wave of light
aurora.shootingStar();
</code></pre>
<p>Here are the three tricks that made it look right and stay cheap.</p>
<h2>1. Draw it tiny, then let the browser blur it</h2>
<p>An aurora is soft. Instead of blurring anything (canvas <code>filter</code> is slow and Safari doesn't support it), I draw the lights into an offscreen canvas at <strong>a quarter of the screen size</strong>, then draw that canvas onto the visible one, scaled up with <code>imageSmoothingQuality = "high"</code>. The upscale is the blur, and it's free.</p>
<p>On top of that there's a second, even smaller copy (a twelfth of the size) drawn underneath at 70% opacity. That gives the soft halo around the bright edges that makes it feel like light rather than paint.</p>
<h2>2. Curtains are just a lot of thin vertical strips</h2>
<p>Each curtain is a wavy line across the screen, made from three sine waves with different speeds:</p>
<pre><code class="language-js">y = base + amp * (
  0.58 * Math.sin(x * f1 + t * s1) +
  0.28 * Math.sin(x * f2 - t * s2) +
  0.14 * Math.sin(x * f3 + t * s3)
);
</code></pre>
<p>For every pixel column of the small canvas, I draw one thin strip upwards from that line. The strip is a pre-rendered 2×160 px gradient: bright and almost white at the bottom edge, the main colour in the middle, fading into violet or pink and then nothing at the top. Real auroras look exactly like that: a bright lower hem with rays rising out of it.</p>
<p>The strips are drawn with <code>globalCompositeOperation = "lighter"</code>, so where curtains overlap they add up and glow, like real light does.</p>
<p>Two things stop it looking like a bar chart:</p>
<ul>
<li><strong>Brightness changes along the curtain</strong> with slow folds plus a faster, finer shimmer, so you see rays without hard steps between columns.</li>
<li><strong>Colour blends smoothly</strong> between three gradients along x. My first version picked one gradient per column and you could see rectangles of colour. Cross-fading between neighbours fixed it.</li>
</ul>
<h2>3. Let the page decide how it blends</h2>
<p>On a dark page the canvas uses <code>mix-blend-mode: screen</code>, so it only ever adds light: text stays readable and the lights glow over a starry sky. On a light page <code>screen</code> would be invisible, so it switches to <code>multiply</code> with deeper colours, which gives a soft watercolour tint across the header instead.</p>
<p>The theme checks the background colour behind the page, and checks again every few seconds, so a site's dark-mode switch is followed automatically.</p>
<h2>The small stuff</h2>
<ul>
<li>The curtains lean towards your cursor and brighten near it. Clicking sends a ripple of light outwards along them.</li>
<li>Stars twinkle, and every 9 to 18 seconds a shooting star crosses the sky (dark pages only).</li>
<li>It fades out as you scroll, pauses in background tabs and slows right down for <code>prefers-reduced-motion</code>.</li>
<li>The canvas has <code>pointer-events: none</code>, so it never blocks a click or text selection.</li>
</ul>
<p>You can limit it to one section too:</p>
<pre><code class="language-js">createAurora({ root: document.querySelector(".hero"), height: 1 });
</code></pre>
<p>Palettes: <code>classic</code>, <code>arctic</code>, <code>sunset</code>, <code>candy</code>, or <code>brand</code> with your own colour.</p>
<hr />
<p>It's part of <a href="https://fluri.xyz/">Fluri</a>, my collection of interactive website effects. The npm packages are free; if you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>I'd love feedback on how it runs on your machine, especially older phones. What would you put under northern lights?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/aurora">https://www.npmjs.com/package/@fluritheme/aurora</a></p>
]]></content:encoded></item><item><title><![CDATA[I built a free webring for 2026: small websites recommend each other]]></title><description><![CDATA[Remember webrings? A little bar at the bottom of a personal site with “← previous | random | next →”, linking you to other small sites like it. That’s how…]]></description><link>https://fluri.hashnode.dev/i-built-a-free-webring-for-2026-small-websites-recommend-each-other</link><guid isPermaLink="true">https://fluri.hashnode.dev/i-built-a-free-webring-for-2026-small-websites-recommend-each-other</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Indieweb]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Wed, 02 Dec 2026 09:05:21 GMT</pubDate><content:encoded><![CDATA[<p>Remember webrings? A little bar at the bottom of a personal site with “← previous | random | next →”, linking you to other small sites like it. That’s how a lot of us found things on the web before search and feeds took over.</p>
<p>Small websites still have the same problem: nobody finds them. Ads are expensive, SEO is slow, and social posts disappear in a day. So I built <strong>Fluri Neighbours</strong>, a free cross-promotion network. Your site shows a few other independent sites, and your site is shown on theirs, in fair rotation.</p>
<p><strong>See the live network:</strong> <a href="https://fluri.xyz/neighbours/">https://fluri.xyz/neighbours/</a></p>
<pre><code class="language-html">&lt;script src="https://fluri.xyz/neighbours.js" defer&gt;&lt;/script&gt;
</code></pre>
<p>That’s the whole install. No sign-up, no account, no cookies, no tracking of your visitors.</p>
<h3>How joining works</h3>
<p>The first time the script runs on your domain over HTTPS, your site joins. An automatic check reads your home page title, description and icon (that’s what other sites will show), and a few minutes later you’re in the rotation.</p>
<p>The check also keeps the network clean: sites must load over HTTPS, have a real home page, and not be adult, gambling, piracy, scam or parked domains. On <code>localhost</code> you only see a sample card, so you can try styles while building.</p>
<h3>Fair rotation, not a popularity contest</h3>
<p>Most recommendation widgets favour whoever pays or whoever is already big. Here every active member is picked about equally often. Each site has a counter of how many times it has been picked, and the next picks come from the sites with the lowest counts. New members start level with everyone else, so joining late doesn’t put you at the back of a queue.</p>
<h3>Honest numbers</h3>
<p>I wanted the stats to mean something, so a view only counts when the widget was actually on screen for a second. When a set of neighbours is served, the server signs a short-lived token. The browser sends it back only after an <code>IntersectionObserver</code> confirms the widget was visible, and the server checks the signature before counting. Reloading a page in a loop doesn’t inflate anything.</p>
<p>You can see your own numbers from the console on your live site:</p>
<pre><code class="language-js">await FluriNeighbours.instance.getStats()
// { status: "active", shown, clicks, sent, served, rank, members }
</code></pre>
<p>The whole network’s live stats are public on the Neighbours page.</p>
<h3>Six styles that fit your site</h3>
<ul>
<li><strong>Footer strip</strong> (default): one quiet line at the end of the page.</li>
<li><strong>Corner card</strong>: slides in after a few seconds; visitors can flip through or close it.</li>
<li><strong>Inline cards</strong>: exactly where you put <code>&lt;div data-fluri-neighbours&gt;&lt;/div&gt;</code>.</li>
<li><strong>List</strong>, <strong>ticker</strong> and a small <strong>badge</strong> with neighbour icons.</li>
</ul>
<p>Everything renders in a shadow DOM, so your CSS can’t break it and it can’t break yours. Light or dark follows your page automatically, the interface speaks 11 languages, and you can restyle any part with <code>::part()</code>. Site icons are passed through a proxy that refuses SVGs, so a neighbour’s icon can never run code on your page.</p>
<pre><code class="language-html">&lt;script src="https://fluri.xyz/neighbours.js"
  data-style="card" data-position="bottom-left"
  data-exclude="my-competitor.com" data-prefer="language" defer&gt;&lt;/script&gt;
</code></pre>
<p>There’s also an npm package (<code>@fluritheme/neighbours</code>) with a JavaScript API and events for React, Vue and Svelte.</p>
<h3>Why is it free?</h3>
<p>I make <a href="https://fluri.xyz/">Fluri</a>, interactive effects for websites, and the whole thing is a bet on small sites helping each other. Neighbours costs me very little to run, and every site that joins makes the network more useful for everyone else, including mine. There’s no paid tier and no ads.</p>
<p>If you have a personal site, a portfolio, a side project or a small shop, add one line and say hi to your neighbours. And tell me what you’d want to see in a webring in 2026.</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/neighbours">https://www.npmjs.com/package/@fluritheme/neighbours</a></p>
]]></content:encoded></item><item><title><![CDATA[A typewriter effect that doesn't hurt SEO, accessibility or layout]]></title><description><![CDATA[A typewriter effect for headings that keeps the full text in the page for SEO and screen readers, and never shifts the layout. Free, MIT.]]></description><link>https://fluri.hashnode.dev/a-typewriter-effect-that-doesn-t-hurt-seo-accessibility-or-layout</link><guid isPermaLink="true">https://fluri.hashnode.dev/a-typewriter-effect-that-doesn-t-hurt-seo-accessibility-or-layout</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[CSS]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Accessibility]]></category><category><![CDATA[SEO]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Tue, 01 Dec 2026 06:43:04 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://fluri.xyz/previews/npm/v2/typewriter.png" alt="Typewriter by Fluri" /></p>
<p>Most typewriter effects empty the heading and add letters back with JavaScript. That has three side effects: search engines and screen readers can see half a sentence, links inside the heading are lost, and the page jumps as lines wrap. <strong>Typewriter</strong> avoids all three. Free (MIT), about 7 KB minified, no dependencies.</p>
<p><a class="embed-card" href="https://codepen.io/fluritheme/pen/QwvzJjj">https://codepen.io/fluritheme/pen/QwvzJjj</a></p>

<h2>Install</h2>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/typewriter@1/dist/typewriter.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<pre><code class="language-js">import { createTypewriter } from "@fluritheme/typewriter";

createTypewriter({
  target: "h1",
  mode: "cycle",                   // "type" | "cycle" | "scramble"
  phrases: ["Write better emails.", "Write better docs."],
  speed: 22,                       // characters per second
});
</code></pre>
<p>The phrases can also live in your HTML, which is handy in a CMS: <code>&lt;h1 data-phrases="Fast|Private|Free"&gt;Fast&lt;/h1&gt;</code> with <code>mode: "cycle"</code>.</p>
<h2>The full text never leaves the page</h2>
<p>In "type" mode every text node is split in two: the part that's been typed, and the rest in a <code>&lt;span&gt;</code> with <code>visibility: hidden</code>. Each step moves one character from the hidden part to the visible one.</p>
<ul>
<li>The whole sentence is in the DOM the entire time, so crawlers and screen readers get all of it.</li>
<li>Hidden text still takes up space, so the heading is its final size from the first frame. Nothing below it moves.</li>
<li>Because it works text node by text node, links, <code>&lt;strong&gt;</code> and <code>&lt;em&gt;</code> inside the heading keep working.</li>
</ul>
<p>In "cycle" mode, a visually hidden span holds all the phrases for screen readers, and the animated text is <code>aria-hidden</code>, so assistive tech doesn't hear letters being typed and deleted.</p>
<h2>A caret that can't break a line</h2>
<p>My first caret was an <code>inline-block</code> element. It sometimes wrapped onto a new line by itself, mid-word. The fix: make the caret an inline span containing a single word joiner (U+2060) and draw the line with <code>border-left</code>. A word joiner is zero-width and forbids a line break on either side, so the caret always stays glued to the last letter.</p>
<h2>Typing like a person</h2>
<p>With <code>human: true</code>, each character's delay is randomised between 0.55× and 1.6× of the base speed, with longer pauses after commas (3×) and full stops (6×). In cycle mode it deletes only back to what the two phrases share, so "Write better emails." → "Write better docs." deletes just "emails.".</p>
<h2>Restarting safely</h2>
<p>Typing is a loop of <code>await</code>ed timeouts. If you call <code>restart()</code> while one is running, the old loop has to stop. Each run captures a generation number, <code>restart()</code> and <code>destroy()</code> bump it, and every step checks it:</p>
<pre><code class="language-js">const g = gen;            // captured when a run starts
// …
await wait(delay);
if (g !== gen || destroyed) return; // a newer run has started
</code></pre>
<p><code>pause()</code>/<code>resume()</code> pause the pending waits instead of cancelling them. It starts when the heading scrolls into view, and <code>prefers-reduced-motion</code> shows the finished text at once.</p>
<hr />
<p>It's one of the free, MIT-licensed packages behind <a href="https://fluri.xyz/typewriter/?utm_source=hashnode">Fluri</a>, my collection of interactive website effects. If you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>Do you use typing effects on your own pages, or do they annoy you?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/typewriter">https://www.npmjs.com/package/@fluritheme/typewriter</a></p>
]]></content:encoded></item><item><title><![CDATA[A connected-dots background in 7 KB: a particles.js alternative with a spatial grid]]></title><description><![CDATA[A connected-dots background in 7 KB: a particles.js alternative that uses a spatial grid and Path2D buckets. Free, MIT.]]></description><link>https://fluri.hashnode.dev/a-connected-dots-background-in-7-kb-a-particles-js-alternative-with-a-spatial-grid</link><guid isPermaLink="true">https://fluri.hashnode.dev/a-connected-dots-background-in-7-kb-a-particles-js-alternative-with-a-spatial-grid</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[canvas]]></category><category><![CDATA[webdev]]></category><category><![CDATA[animation]]></category><category><![CDATA[frontend]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Tue, 01 Dec 2026 06:42:40 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://fluri.xyz/previews/npm/v2/constellation.png" alt="Constellation by Fluri" /></p>
<p>The "dots that connect when they come close" background is a classic. particles.js made it famous, but its last release is from 2015 and it checks the distance between every pair of particles. <strong>Constellation</strong> is a small modern take: about 7.6 KB minified, MIT, no dependencies, and it sits behind your content by default.</p>
<p><a class="embed-card" href="https://codepen.io/fluritheme/pen/WbjLYQv">https://codepen.io/fluritheme/pen/WbjLYQv</a></p>

<h2>Install</h2>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/constellation@1/dist/constellation.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<pre><code class="language-js">import { createConstellation } from "@fluritheme/constellation";

const sky = createConstellation({
  palette: "auto",       // follows light/dark pages; "night", "ink", "neon", "brand"
  density: 1,
  linkDistance: 130,
  interaction: "grab",   // "repel", "attract" or "none"
});
</code></pre>
<h2>Only check the neighbours</h2>
<p>Comparing every dot with every other dot is O(n²): 200 dots means about 20,000 distance checks per frame. Instead, every frame the dots are dropped into a grid whose cells are as big as the link distance. Two dots can only be linked if they are in the same or a neighbouring cell, so each dot checks just its 3×3 block of cells:</p>
<pre><code class="language-js">for (let gy = cy - 1; gy &lt;= cy + 1; gy++)
  for (let gx = cx - 1; gx &lt;= cx + 1; gx++)
    for (const j of grid[gy * cols + gx] ?? []) {
      if (j &lt;= i) continue; // each pair once
      // distance check…
    }
</code></pre>
<p>The number of dots also scales with the screen area (and is capped), so a phone doesn't get a desktop's worth.</p>
<h2>Few strokes instead of hundreds</h2>
<p>Closer dots get stronger lines. Setting <code>strokeStyle</code> and calling <code>stroke()</code> for every line is slow, so each line goes into one of <strong>8 <code>Path2D</code> buckets</strong> by how strong it should be, and each bucket is stroked once. That's 8 draw calls for all the lines, however many there are:</p>
<pre><code class="language-js">const k = 1 - Math.sqrt(d2) / L;
const b = Math.min(BUCKETS - 1, Math.floor(k * k * BUCKETS));
paths[b].moveTo(p.x, p.y);
paths[b].lineTo(q.x, q.y);
</code></pre>
<p>Squaring <code>k</code> makes lines fade in gently as dots approach, instead of popping in.</p>
<h2>The cursor</h2>
<ul>
<li><strong>grab</strong> draws lines from the cursor to nearby dots.</li>
<li><strong>repel</strong> and <strong>attract</strong> push or pull dots, with damping so they settle again.</li>
<li>A click on empty space adds a few dots; clicks on links, buttons and form fields are ignored.</li>
</ul>
<p>The "auto" palette reads the page's background and picks dark dots on light pages and light ones on dark pages. Dots twinkle softly, which is switched off with <code>prefers-reduced-motion</code>, as is drifting.</p>
<hr />
<p>It's one of the free, MIT-licensed packages behind <a href="https://fluri.xyz/constellation/?utm_source=hashnode">Fluri</a>, my collection of interactive website effects. If you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>What would you use it for: a hero, a 404 page, a login screen?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/constellation">https://www.npmjs.com/package/@fluritheme/constellation</a></p>
]]></content:encoded></item><item><title><![CDATA[An animated mesh gradient in 8 KB without WebGL: the blur is free]]></title><description><![CDATA[An animated mesh gradient background in 8 KB without WebGL: draw tiny, scale up, add grain. Plus PNG and CSS export. Free, MIT.]]></description><link>https://fluri.hashnode.dev/an-animated-mesh-gradient-in-8-kb-without-webgl-the-blur-is-free</link><guid isPermaLink="true">https://fluri.hashnode.dev/an-animated-mesh-gradient-in-8-kb-without-webgl-the-blur-is-free</guid><category><![CDATA[CSS]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Design]]></category><category><![CDATA[canvas]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Tue, 01 Dec 2026 06:42:17 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://fluri.xyz/previews/npm/v2/mesh-gradient.png" alt="Mesh Gradient by Fluri" /></p>
<p>Soft, slowly moving colour backgrounds are everywhere on SaaS landing pages. The well-known way to make them is a WebGL shader. I wanted one that is small, works everywhere a 2D canvas does, and can also give you a <strong>still PNG or plain CSS</strong> when you don't want any JavaScript at all.</p>
<p><strong>Mesh Gradient</strong> is free (MIT), about 8 KB minified, no dependencies.</p>
<p><a class="embed-card" href="https://codepen.io/fluritheme/pen/NPjeEGP">https://codepen.io/fluritheme/pen/NPjeEGP</a></p>

<h2>Install</h2>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/mesh-gradient@1/dist/mesh-gradient.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<pre><code class="language-js">import { createMeshGradient } from "@fluritheme/mesh-gradient";

const mesh = createMeshGradient({ preset: "aurora", speed: 1, grain: 0.35 });
mesh.setPreset("midnight");
</code></pre>
<p>Prefer no JavaScript? The <a href="https://fluri.xyz/tools/mesh-gradient-generator/?utm_source=hashnode">free generator</a> exports a PNG up to 4K, or CSS you can paste.</p>
<h2>The trick: draw tiny, scale up</h2>
<p>A mesh gradient is just a few big, very blurry colour blobs. Blurring a full-screen canvas every frame is expensive, so I don't. The blobs are drawn as radial gradients on a canvas <strong>one tenth</strong> of the screen size, and that small canvas is drawn onto the full-size one with smoothing on:</p>
<pre><code class="language-js">c.imageSmoothingEnabled = true;
c.imageSmoothingQuality = "high";
c.drawImage(low, 0, 0, w, h);
</code></pre>
<p>Upscaling a 10× smaller image <em>is</em> a blur, and the browser does it for free. Painting four gradients on a 192×108 canvas costs almost nothing, so it runs at a capped 30 fps without making laptops warm.</p>
<h2>Movement</h2>
<p>Each blob moves on a slow Lissajous path (a sine for x, a cosine for y, different frequencies), so the motion never visibly repeats. Three small touches make it feel alive:</p>
<ul>
<li>The first colour blob leans towards the cursor, eased so it follows lazily.</li>
<li>Scrolling shifts the phase of every path a little, so the colours drift as you read.</li>
<li>Switching presets fades every colour across instead of jumping.</li>
</ul>
<h2>Grain against banding</h2>
<p>Big smooth gradients band on 8-bit screens. A 128×128 tile of random grey noise is made once, turned into a repeating pattern and laid over the gradient with the <code>overlay</code> blend mode at a few percent opacity. It hides the bands and gives that slightly filmic look.</p>
<h2>PNG and CSS export</h2>
<p>Because everything is drawn from a few numbers, exporting is easy:</p>
<ul>
<li><code>snapshot(width, height)</code> renders the current frame into a new canvas at any size, with full-resolution grain, ready for <code>toBlob()</code>.</li>
<li><code>cssBackground()</code> turns the blobs' current positions and sizes into stacked <code>radial-gradient()</code> layers over a background colour, so a static version can match the live one.</li>
</ul>
<p>With <code>prefers-reduced-motion</code> it paints a single still frame and only repaints when the size changes.</p>
<hr />
<p>It's one of the free, MIT-licensed packages behind <a href="https://fluri.xyz/mesh-gradient/?utm_source=hashnode">Fluri</a>, my collection of interactive website effects. If you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>Which preset would you put behind your hero: aurora, sunset, ocean, candy, forest or midnight?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/mesh-gradient">https://www.npmjs.com/package/@fluritheme/mesh-gradient</a></p>
]]></content:encoded></item><item><title><![CDATA[Soap bubbles you can pop: thin-film colours with conic gradients and a Web Audio pop]]></title><description><![CDATA[Soap bubbles you can pop on any website: thin-film colours with conic gradients and a pop sound made with Web Audio. Free, MIT.]]></description><link>https://fluri.hashnode.dev/soap-bubbles-you-can-pop-thin-film-colours-with-conic-gradients-and-a-web-audio-pop</link><guid isPermaLink="true">https://fluri.hashnode.dev/soap-bubbles-you-can-pop-thin-film-colours-with-conic-gradients-and-a-web-audio-pop</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[canvas]]></category><category><![CDATA[animation]]></category><category><![CDATA[Web Audio]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Tue, 01 Dec 2026 06:41:31 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://fluri.xyz/previews/npm/v2/bubble-pop.png" alt="Bubble Pop by Fluri" /></p>
<p>Some effects are just for joy. <strong>Bubble Pop</strong> floats shimmering soap bubbles over a website. Touch one with the cursor or a finger and it pops with a spray of droplets and a soft "pop". A wand blows a stream of bubbles now and then, and a counter can unlock a discount code after enough pops.</p>
<p>Free, MIT, about 15 KB minified, no dependencies.</p>
<p><a class="embed-card" href="https://codepen.io/fluritheme/pen/MYmZPNe">https://codepen.io/fluritheme/pen/MYmZPNe</a></p>

<h2>Install</h2>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/bubble-pop@1/dist/bubble-pop.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<pre><code class="language-js">import { createBubblePop } from "@fluritheme/bubble-pop";

createBubblePop({ palette: "rainbow", popsForReward: 15, code: "BUBBLES10" });
</code></pre>
<h2>Drawing a soap bubble</h2>
<p>A real bubble is almost clear in the middle and colourful at the edge, where you look through more of the film. So each bubble is three layers:</p>
<ol>
<li>A radial gradient that is nearly transparent in the centre and gets more coloured and brighter towards the rim.</li>
<li>A rim stroked with a <strong>conic gradient</strong> of rotating hues. That's the swirling rainbow of thin-film interference, and rotating its start angle over time makes it shimmer:</li>
</ol>
<pre><code class="language-js">const rim = ctx.createConicGradient(clock * 0.6 + b.ph, 0, 0);
for (let k = 0; k &lt;= 6; k++) rim.addColorStop(k / 6, c(k * 60) + "0.55)");
</code></pre>
<ol start="3">
<li>Two white reflections: an angled ellipse at the top left (the window) and a small dot at the bottom right.</li>
</ol>
<p>Each bubble also wobbles by scaling x and y with slightly different sine waves, which sells the "soft film" feel. On light pages a faint outline keeps them visible; on dark pages the colours are brighter.</p>
<h2>Popping with a swipe</h2>
<p>In "touch" mode, a bubble pops when the pointer touches it. Fast swipes would skip over bubbles between two <code>pointermove</code> events, so the code checks points along the path between the last and current pointer position, every 12 px. Popping spawns a quickly expanding ring and a dozen droplets with gravity, coloured from the bubble's film.</p>
<h2>A pop sound with no audio file</h2>
<p>The sound is a sine oscillator that drops in pitch over 60 ms with a very fast gain envelope. Smaller bubbles pop higher:</p>
<pre><code class="language-js">const f0 = clamp(1500 - r * 18, 500, 1400);
osc.frequency.setValueAtTime(f0, t);
osc.frequency.exponentialRampToValueAtTime(f0 * 0.3, t + 0.06);
g.gain.exponentialRampToValueAtTime(0.16, t + 0.004);
g.gain.exponentialRampToValueAtTime(0.0001, t + 0.08);
</code></pre>
<p>Browsers don't allow audio before the visitor has interacted, so the sound stays off until the first click, tap or key press. Hover pops before that are silent, which is exactly right.</p>
<h2>The rest</h2>
<ul>
<li>A wand blows a staggered stream of bubbles from one side every 14–24 seconds, like one long breath.</li>
<li>A pop counter button and an optional reward card with a code; a <code>fluri-bubble-pop</code> event fires on each pop.</li>
<li><code>prefers-reduced-motion</code>: fewer, slower bubbles, no wobble, no wand and no sound.</li>
</ul>
<hr />
<p>It's one of the free, MIT-licensed packages behind <a href="https://fluri.xyz/bubble-pop/?utm_source=hashnode">Fluri</a>, my collection of interactive website effects. If you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>Where would bubbles make sense on your site: a kids' shop, a soap brand, a 404 page?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/bubble-pop">https://www.npmjs.com/package/@fluritheme/bubble-pop</a></p>
]]></content:encoded></item><item><title><![CDATA[Snow that settles on your headings: a falling snow effect with real piles]]></title><description><![CDATA[A falling snow effect where flakes settle on headings and cards, pile up and can be brushed off. Free, MIT, about 11 KB.]]></description><link>https://fluri.hashnode.dev/snow-that-settles-on-your-headings-a-falling-snow-effect-with-real-piles</link><guid isPermaLink="true">https://fluri.hashnode.dev/snow-that-settles-on-your-headings-a-falling-snow-effect-with-real-piles</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[CSS]]></category><category><![CDATA[Christmas]]></category><category><![CDATA[animation]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Tue, 01 Dec 2026 06:40:41 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://fluri.xyz/previews/npm/v2/falling-snow.png" alt="Falling Snow by Fluri" /></p>
<p>Falling snow is the most searched website effect of December, and most versions are the same: white dots fall and disappear at the bottom. I wanted the snow to <strong>land on the page</strong>: build up on headings, cards and images, pile up along the bottom of the screen, and get brushed off when you swipe across it.</p>
<p><strong>Falling Snow</strong> is free (MIT), about 11 KB minified, no dependencies.</p>
<p><a class="embed-card" href="https://codepen.io/fluritheme/pen/KwmbGOd">https://codepen.io/fluritheme/pen/KwmbGOd</a></p>

<h2>Install</h2>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/falling-snow@1/dist/falling-snow.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<pre><code class="language-js">import { createFallingSnow } from "@fluritheme/falling-snow";

const snow = createFallingSnow({
  amount: 1,
  surfaces: "h1, h2, .card, img",  // where snow settles
  depth: 14,                       // deepest pile in px
  melt: 90,                        // seconds to melt to half
});
snow.gust();
</code></pre>
<h2>Three layers of depth</h2>
<p>Each flake gets a depth <code>z</code> between 0 and 1, picked with <code>Math.random() ** 1.6</code> so there are more distant flakes than near ones. Near flakes are bigger, faster and more opaque; far ones are small and faint. Only flakes with <code>z &gt; 0.42</code> settle. The far ones keep falling "behind" the page, which is what makes it feel deep rather than flat.</p>
<h2>A pile is just an array of heights</h2>
<p>Every surface gets a <code>Float32Array</code> with one height per 4 px column. When a near flake crosses the top of a surface between two frames, it adds snow to that column and spreads some to its neighbours with a Gaussian falloff:</p>
<pre><code class="language-js">for (let k = -4; k &lt;= 4; k++) {
  const edge = Math.min(j, n - 1 - j) * COL;          // distance to the ledge edge
  const cap = max * clamp(edge / 18, 0.12, 1);        // thinner near the edges
  p.cols[j] = Math.min(cap, p.cols[j] + amt * 0.25 * Math.exp(-(k * k) / 5));
}
</code></pre>
<p>Every 0.2 s the pile relaxes (each column moves a little towards the average of its neighbours) so it forms soft mounds instead of spikes, and melts slowly with a half-life. The pile is drawn as one path with <code>quadraticCurveTo</code> through the column midpoints.</p>
<h2>Landing on letters, not on the box</h2>
<p>A heading's box includes empty line-height above the text, so snow "on the h1" would float in the air. For plain text elements I measure the first line of text with a <code>Range</code> and land the snow there, and only across the width of the text, not the empty space to its right:</p>
<pre><code class="language-js">const range = document.createRange();
range.selectNodeContents(el);
const t = range.getClientRects()[0];
</code></pre>
<p>Cards, images and buttons use their box. The result is cached per element and recomputed when its width changes.</p>
<h2>Brushing it off</h2>
<p>The pointer's velocity is tracked. If it moves faster than 120 px/s through a pile, that part of the pile is removed and thrown back into the air as flakes moving in the direction of the swipe. The cursor also stirs falling flakes within 130 px. Both feel surprisingly physical for a few lines of code.</p>
<h2>Visible on white pages</h2>
<p>White snow on a white page is invisible. On light pages the flakes get a slightly cool tint and a soft blue-grey shadow, and piles get a thin cool edge. The page colour is checked every few seconds, so dark-mode switches are followed.</p>
<p>Everything is on one canvas with <code>pointer-events: none</code>, it pauses in hidden tabs, and <code>prefers-reduced-motion</code> gets far fewer, slower flakes without sway.</p>
<hr />
<p>It's one of the free, MIT-licensed packages behind <a href="https://fluri.xyz/falling-snow/?utm_source=hashnode">Fluri</a>, my collection of interactive website effects. If you run WordPress, Shopify or Wix there's a no-code version with live settings.</p>
<p>What should settle on next: buttons, images, the navbar?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/falling-snow">https://www.npmjs.com/package/@fluritheme/falling-snow</a></p>
]]></content:encoded></item><item><title><![CDATA[I let visitors throw snowballs at my website]]></title><description><![CDATA[Every December, websites get a bit of falling snow. It's nice, but you just watch it. I wanted the opposite: snow you can throw. So I made Snowball Fight…]]></description><link>https://fluri.hashnode.dev/i-let-visitors-throw-snowballs-at-my-website</link><guid isPermaLink="true">https://fluri.hashnode.dev/i-let-visitors-throw-snowballs-at-my-website</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Christmas]]></category><category><![CDATA[Games]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Mon, 30 Nov 2026 09:34:39 GMT</pubDate><content:encoded><![CDATA[<p>Every December, websites get a bit of falling snow. It's nice, but you just watch it. I wanted the opposite: snow you can <em>throw</em>.</p>
<p>So I made <strong>Snowball Fight</strong>. Click or tap anywhere on the page and a snowball arcs in from the bottom of the screen, splats against the page and slowly slides down as it melts. Headings and images you hit give a little wobble. And now and then a snowman pops up from the bottom edge, daring you to knock his hat off.</p>
<p><img src="https://fluri.xyz/previews/npm/snowball-fight.png" alt="Snowball Fight by Fluri: snowball splats and a snowman on a website" /></p>
<p><strong>Throw a few:</strong> <a href="https://fluri.xyz/snowball-fight/">https://fluri.xyz/snowball-fight/</a></p>
<p>One line to add it to any site:</p>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/snowball-fight@1/dist/snowball-fight.global.js" data-auto&gt;&lt;/script&gt;
</code></pre>
<h2>"Won't that break my site?"</h2>
<p>That was my first worry too. Only clicks on empty parts of the page throw a snowball. Links, buttons, form fields, videos and anything focusable work exactly as before, and selecting text never throws. If that still feels like too much, <code>trigger: "button"</code> means snowballs only fly from a small button in the corner.</p>
<h2>A few details I enjoyed building</h2>
<ul>
<li><strong>The splat</strong> is generated fresh every time: a squashed core, 7 to 11 lumps around it, a handful of streaks shooting outwards ending in droplets, and loose specks. A soft blue shadow keeps it visible on white pages.</li>
<li><strong>The sliding.</strong> After about a second, most splats start creeping down the page, leaving a fading wet smear above them, then melt away after 30 seconds. Some just stay stuck, like real snow on a window.</li>
<li><strong>The wobble</strong> uses the Web Animations API with <code>composite: "add"</code>, so it rotates the element you hit without wiping out any transform it already has.</li>
<li><strong>The snowman</strong> is drawn on the canvas, no images. Hit him and his hat spins off with real gravity, for 3 points and a "Bullseye!"</li>
</ul>
<h2>Turn it into a little game</h2>
<p>There's a hit counter in the corner, and you can unlock a reward for good aim:</p>
<pre><code class="language-js">import { createSnowballFight } from "@fluritheme/snowball-fight";

createSnowballFight({
  hitsForReward: 5,
  message: "Great aim! Here's 10% off.",
  code: "SNOWBALL10",
});
</code></pre>
<p>Every hit fires a <code>fluri-snowball-hit</code> event, if you want to count hits in your analytics (I'm curious how many people play).</p>
<p>It respects <code>prefers-reduced-motion</code>, has no dependencies, and the whole thing is free and MIT-licensed.</p>
<hr />
<p>It's part of <a href="https://fluri.xyz/">Fluri</a>, my collection of playful website effects. There's also a no-code version for WordPress, Shopify and Wix.</p>
<p>How many hits did you get? Did you get the snowman?</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/snowball-fight">https://www.npmjs.com/package/@fluritheme/snowball-fight</a></p>
]]></content:encoded></item><item><title><![CDATA[How I built a scratch card that feels real, in plain canvas]]></title><description><![CDATA[Ragged edges, flying foil and knowing when enough is scratched]]></description><link>https://fluri.hashnode.dev/how-i-built-a-scratch-card-that-feels-real-in-plain-canvas</link><guid isPermaLink="true">https://fluri.hashnode.dev/how-i-built-a-scratch-card-that-feels-real-in-plain-canvas</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Mon, 30 Nov 2026 09:33:20 GMT</pubDate><content:encoded><![CDATA[<p>Scratch cards are one of the oldest tricks in marketing, and for a good reason: people can't leave foil alone. I wanted one for websites that actually feels like scratching a lottery ticket with a coin, not like dragging an eraser in Paint.</p>
<p>The result is <strong>Scratch Card</strong>, a free MIT package with no dependencies. A little ticket slides in from the corner, visitors scratch the foil with a finger or the mouse, and they find a prize and a discount code underneath.</p>
<p><img src="https://fluri.xyz/previews/npm/scratch-card.png" alt="Scratch Card by Fluri: a gold foil ticket half scratched on a shop's homepage" /></p>
<p><strong>Try it:</strong> <a href="https://fluri.xyz/scratch-card/">https://fluri.xyz/scratch-card/</a></p>
<pre><code class="language-js">import { createScratchCard } from "@fluritheme/scratch-card";

createScratchCard({
  prize: "15% OFF",
  message: "on everything until Sunday",
  code: "WINTER15",
  foil: "gold", // silver, gold, holo or brand
});
</code></pre>
<p>Here's what went into making it feel right.</p>
<h2>The foil is painted, not an image</h2>
<p>Each foil is drawn on a canvas when the ticket opens, so it's sharp on every screen and slightly different every time:</p>
<ol>
<li>A diagonal gradient through six shades of silver or gold.</li>
<li>A few slanted bands of white at low opacity, like light catching crinkled foil.</li>
<li>A couple of thousand single-pixel dots, half light and half dark, for grain.</li>
<li>A faint diamond pattern and the embossed "SCRATCH HERE" label: the text drawn once dark and offset by a pixel, then light on top.</li>
</ol>
<p>The holographic foil adds a rainbow gradient at 35% opacity over the silver.</p>
<h2>Scratching with ragged edges</h2>
<p>The basic scratch is the classic trick: draw on the foil canvas with <code>globalCompositeOperation = "destination-out"</code>, which erases instead of painting.</p>
<p>A plain round line looks fake, though. Real foil tears unevenly. So along every stroke, every 5 pixels, I also erase three small circles at random points around the edge of the line. That gives a chewed, uneven border, like a coin catching the foil.</p>
<p>While you scratch, tiny triangles of foil in the same colours fly off in the direction you're moving and fall with gravity. On Android phones there's also a 4 ms vibration every 70 ms while your finger moves, which feels surprisingly like friction.</p>
<h2>Knowing when it's "scratched enough"</h2>
<p>Nobody wants to clear every last pixel. Every 140 ms during a scratch I read the canvas back with <code>getImageData</code> and count how many pixels are mostly transparent. To keep it cheap I only check every seventh pixel; that's plenty for a percentage.</p>
<p>Once 45% is gone (you can change it), the rest of the foil fades away by itself and confetti pops out of the spot where your finger is. The canvas is created with <code>willReadFrequently: true</code>, which tells the browser to keep it in memory where reading it back is fast.</p>
<h2>Small things that matter</h2>
<ul>
<li><strong>It remembers.</strong> Once someone has revealed their prize, the ticket shows the code straight away on their next visit, instead of asking them to scratch again.</li>
<li><strong>It doesn't nag.</strong> It opens once after a few seconds. Close it and it folds into a small tab for the rest of the visit.</li>
<li><strong>Accessibility.</strong> The foil is a focusable button. Enter reveals it, and there's a "Just show me" link for anyone who can't or won't scratch.</li>
<li><strong>Tracking.</strong> Every reveal fires a <code>fluri-scratch-reveal</code> event you can send to your analytics.</li>
</ul>
<h2>Bonus: scratch anything on your page</h2>
<p>The same foil can cover elements on your own site, for mystery prices or a hidden link:</p>
<pre><code class="language-html">&lt;span class="mystery-price" data-scratch-label="?"&gt;€9&lt;/span&gt;

&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/scratch-card@1/dist/scratch-card.global.js"
  data-auto data-options='{"target":".mystery-price","ticket":false}'&gt;&lt;/script&gt;
</code></pre>
<hr />
<p>Scratch Card is part of <a href="https://fluri.xyz/">Fluri</a>, a collection of interactive effects for websites. The npm package is free. Shop owners on WordPress, Shopify or Wix can use the no-code version and change the prize from a dashboard.</p>
<p>If you try it, tell me what you'd hide under the foil.</p>
<p>npm: <a href="https://www.npmjs.com/package/@fluritheme/scratch-card">https://www.npmjs.com/package/@fluritheme/scratch-card</a></p>
]]></content:encoded></item><item><title><![CDATA[Frosted glass you can wipe with your finger]]></title><description><![CDATA[How to build a frosted window effect visitors wipe with a finger: ice ferns, canvas masks, drips and a backdrop-filter blur.]]></description><link>https://fluri.hashnode.dev/frosted-glass-you-can-wipe-with-your-finger</link><guid isPermaLink="true">https://fluri.hashnode.dev/frosted-glass-you-can-wipe-with-your-finger</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[CSS]]></category><category><![CDATA[side project]]></category><dc:creator><![CDATA[Frantisek Gejdos]]></dc:creator><pubDate>Sun, 29 Nov 2026 18:43:32 GMT</pubDate><content:encoded><![CDATA[<p>Open <a href="https://fluri.xyz/frosted-window/?utm_source=hashnode">this page</a> and move your cursor, or your finger on a phone. The frost around the edges wipes clear in soft streaks. Press and drag to draw a heart. Drops gather and run down what you cleared, and after a while the frost creeps back.</p>
<p>I'm František from <a href="https://fluri.xyz/?utm_source=hashnode">Fluri</a>, where I make animated effects for websites. The Frosted Window is free on npm under MIT. Here is how it's built, layer by layer.</p>
<h2>Three layers</h2>
<p>The effect is three things stacked over the page, none of which catch clicks:</p>
<ol>
<li><strong>Real blur.</strong> A full-screen <code>div</code> with <code>backdrop-filter: blur(7px)</code>, so the page behind the frost looks seen through iced glass.</li>
<li><strong>The frost picture.</strong> Haze, ice ferns and sparkle, painted once onto an offscreen canvas.</li>
<li><strong>What's been wiped.</strong> A mask canvas. Every wipe, written line and drop trail is painted into it, and it is cut out of the frost each frame.</li>
</ol>
<p>The visible canvas only does this, plus a few twinkling glints:</p>
<pre><code class="language-js">ctx.clearRect(0, 0, w, h);
ctx.drawImage(frost, 0, 0, w, h);                  // the frost picture
ctx.globalCompositeOperation = "destination-out";   // cut away...
ctx.drawImage(wiped, 0, 0, w, h);                  // ...what's been wiped
ctx.drawImage(message, 0, 0, w, h);                // ...and any written message
ctx.globalCompositeOperation = "source-over";
</code></pre>
<h2>Where frost grows</h2>
<p>Real windows freeze from the edges and corners first. One function gives the frost density at any point: 0 in the clear middle, 1 at the frozen edge. Noise breaks up the boundary so it doesn't look like a vignette.</p>
<pre><code class="language-js">function density(x, y) {
  const band = coverage * 0.5 * Math.min(w, h) + 40;  // how far the frost reaches in
  let t = 1 - Math.min(x, y, w - x, h - y) / band;    // distance from the nearest edge
  const cx = Math.min(x, w - x), cy = Math.min(y, h - y);
  t = Math.max(t, 1 - Math.hypot(cx, cy) / (band * 1.9)); // corners freeze first
  t += noise(x / 140, y / 140) * 0.42;                   // an organic edge
  t = Math.min(1, Math.max(0, t));
  return t * t * (3 - 2 * t);                            // smoothstep
}
</code></pre>
<p>The haze is computed at a quarter of the resolution into <code>ImageData</code>, then drawn at full size. The browser's smoothing turns it into soft, frosty clouds for free, and it takes a few milliseconds even on a large screen.</p>
<h2>Growing ice ferns</h2>
<p>My first crystals were straight branching lines, and they looked like twigs. Real window frost looks like feathers: a gently curving stem with dense, short barbs on both sides, longest in the middle.</p>
<pre><code class="language-js">function fern(x, y, angle, length, width) {
  const curve = rand(-0.012, 0.012);
  const steps = Math.floor(length / 3);
  for (let i = 0; i &lt; steps; i++) {
    const t = i / steps;
    if (density(x, y) &lt; 0.12) break;          // stop where the glass is clear
    angle += curve;
    const nx = x + Math.cos(angle) * 3, ny = y + Math.sin(angle) * 3;
    stems.moveTo(x, y);
    stems.lineTo(nx, ny);
    const reach = width * Math.sin(Math.PI * t) ** 0.7; // a feather outline
    for (const side of [-1, 1]) {
      const a = angle + side * rand(0.85, 1.1);         // barbs at about 55°
      barbs.moveTo(nx, ny);
      barbs.lineTo(nx + Math.cos(a) * reach, ny + Math.sin(a) * reach);
    }
    x = nx;
    y = ny;
  }
}
</code></pre>
<p>Stems start on the edges and grow towards the centre at random angles. A 1440 × 900 window gets around 130 stems, plus smaller side ferns, which adds up to thousands of line segments. Stroking each one separately is slow, so every segment goes into one of a few <code>Path2D</code> objects, and each path is stroked once.</p>
<p>A few small six-armed stars go in the thickest ice, and some single-pixel sparkle dust.</p>
<h2>Wiping</h2>
<p>The brush is a soft radial gradient rendered once into a small canvas. Wiping stamps it along the pointer's path, every 28% of the brush radius, so fast movements still leave a smooth streak:</p>
<pre><code class="language-js">function wipeTo(x, y, r) {
  const n = Math.max(1, Math.ceil(Math.hypot(x - lastX, y - lastY) / (r * 0.28)));
  for (let i = 1; i &lt;= n; i++) {
    const px = lastX + ((x - lastX) * i) / n;
    const py = lastY + ((y - lastY) * i) / n;
    wipedCtx.drawImage(brush, px - r, py - r, r * 2, r * 2);
  }
  lastX = x;
  lastY = y;
}
</code></pre>
<p>On phones I listen to <code>touchmove</code> instead of pointer events. Pointer events stop as soon as the browser starts scrolling, but touch events keep coming, so you can wipe and scroll at once.</p>
<p>Pressing and dragging draws a thin line instead, like a fingertip. That's how people write their names in it.</p>
<h2>A real blur that follows the wipes</h2>
<p><code>backdrop-filter</code> blurs the whole layer, but the blur should disappear where the frost is wiped. CSS <code>mask-image</code> can do that, but it takes an image, not a live canvas.</p>
<p>The blur doesn't need detail, so I build its mask from a tiny canvas at one eighth of the size: frost density minus what's been wiped. I turn it into a data URL at most every 140 ms, and only when something changed. At that size <code>toDataURL()</code> takes about a millisecond.</p>
<pre><code class="language-js">bctx.drawImage(densityLowRes, 0, 0);
bctx.globalCompositeOperation = "destination-out";
bctx.drawImage(wiped, 0, 0, small.width, small.height);
const url = `url(${small.toDataURL()})`;
glass.style.maskImage = url;
glass.style.webkitMaskImage = url;
</code></pre>
<p>The mask is stretched to full screen with <code>mask-size: 100% 100%</code>, and being blurry looks right.</p>
<h2>Drops that run down the glass</h2>
<p>While wiping, there's a small chance a drop forms at the bottom of the brush. A drop hesitates, starts running, sometimes stops again, and wobbles slightly. As it moves, it paints a thin line into the wipe mask, so it leaves a clear trail through the frost.</p>
<pre><code class="language-js">if (drop.hold &gt; 0) drop.hold -= dt;           // waiting
else {
  drop.vy = Math.min(140, drop.vy + 160 * dt);
  if (Math.random() &lt; 0.02) drop.hold = rand(0.1, 0.6); // stops for a moment
  const ny = drop.y + drop.vy * dt;
  clearLine(drop.x, drop.y, drop.x, ny, drop.r * 1.25);  // the trail
  drop.y = ny;
}
</code></pre>
<p>Each drop is drawn as a small ellipse with a radial gradient: a bright highlight, a clear middle and a darker rim, which reads as a bead of water.</p>
<h2>The frost grows back</h2>
<p>Twice a second, if nobody has wiped for a moment, the wipe mask fades a little:</p>
<pre><code class="language-js">const step = 1 - Math.pow(0.03, 0.5 / regrowSeconds);
wipedCtx.globalCompositeOperation = "destination-out";
wipedCtx.fillStyle = `rgba(0,0,0,${step})`;
wipedCtx.fillRect(0, 0, w, h);
</code></pre>
<p>After <code>regrowSeconds</code>, 3% of a wipe is left, which you can't see. Canvas alpha is stored in 8 bits, so tiny fades every frame would get stuck on a faint ghost of every wipe. Bigger steps twice a second avoid that.</p>
<p>A message, such as a discount code, sits in its own mask that never fades, so it stays readable.</p>
<h2>Light and dark pages</h2>
<p>White frost over a dark page looks great, but over a white page it's invisible. The script checks the page background behind it. On light pages the haze becomes a cooler blue-grey, and every crystal gets a faint blue outline drawn underneath it.</p>
<h2>Try it</h2>
<ul>
<li><a href="https://fluri.xyz/frosted-window/?utm_source=hashnode">Live demo</a>: wipe it, write in it.</li>
<li>On npm: <code>npm install @fluritheme/frosted-window</code></li>
<li>One line of HTML, with a message written into the frost:</li>
</ul>
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/@fluritheme/frosted-window@1/dist/frosted-window.global.js"
  data-auto data-options='{"message":"Merry Christmas"}'&gt;&lt;/script&gt;
</code></pre>
<p>It respects <code>prefers-reduced-motion</code>, pauses in hidden tabs and never blocks a click.</p>
<p>What would you write on a frozen window? If you try it on your site, send me a link.</p>
]]></content:encoded></item></channel></rss>