Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

fix: Snow / Rain: the prompt's depth sentence holds with Depth on or off, the sky starts under the stage border, and the home preview's flakes form no grid

matin57d4d8439a3f
diff --git a/animations/07-ambient-background/snow-rain/index.html b/animations/07-ambient-background/snow-rain/index.html
index 6e2c957e..d7931238 100644
--- a/animations/07-ambient-background/snow-rain/index.html
+++ b/animations/07-ambient-background/snow-rain/index.html
@@ -23,8 +23,9 @@
<style>
:root{--ui-accent:#ffce5a}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- /* A night sky with the town's warm glow low down; the town is a still picture and the canvas over it holds only the weather */
- .stage{position:relative;overflow:hidden;background:radial-gradient(ellipse 70% 45% at 50% 100%,rgba(255,170,90,.13),transparent),linear-gradient(#03050b,#0a1020 50%,#18223a)}
+ /* A night sky with the town's warm glow low down, drawn from under the stage's see-through border; the town is a still
+ picture and the canvas over it holds only the weather */
+ .stage{position:relative;overflow:hidden;background:radial-gradient(ellipse 70% 45% at 50% 100%,rgba(255,170,90,.13),transparent),linear-gradient(#03050b,#0a1020 50%,#18223a);background-origin:border-box}
.town{position:absolute;left:0;bottom:0;width:100%;height:34%;display:block}
canvas{position:absolute;inset:0;display:block;width:100%;height:100%}
</style>
@@ -113,7 +114,7 @@
<div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
</div>
<div class="hb-card">
- <p class="hb-prompt">Add falling snow or rain to [the dark section you want it over]. Lay a see-through canvas over the section and draw small particles on it, moving each one down on every frame by the time that has passed, and start it again at the top once it leaves the bottom. Snowflakes fall slowly and sway from side to side; raindrops fall fast and are drawn as short streaks that lean with the wind. Give every particle a depth, so near ones are bigger, brighter and faster than far ones. Draw fewer particles on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.</p>
+ <p class="hb-prompt">Add falling snow or rain to [the dark section you want it over]. Lay a see-through canvas over the section and draw small particles on it, moving each one down on every frame by the time that has passed, and start it again at the top once it leaves the bottom. Snowflakes fall slowly and sway from side to side; raindrops fall fast and are drawn as short streaks that lean with the wind. When depth is on, make near particles bigger, brighter and faster than far ones. Draw fewer particles on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.</p>
<div class="hb-chips-box" hidden>
<p class="hb-chips-title">Your settings</p>
<ul class="hb-chips"></ul>
diff --git a/index.html b/index.html
index 61410a06..545036ab 100644
--- a/index.html
+++ b/index.html
@@ -826,15 +826,17 @@ button,input{font:inherit;color:inherit}
.pv-wavelayers .l2{top:56cqh;color:#123f5a;animation-duration:9.5s;animation-delay:-4s}.pv-wavelayers .l2 svg{height:10cqh}
.pv-wavelayers .l3{top:71cqh;color:#08263b;animation-duration:7s;animation-delay:-2s}.pv-wavelayers .l3 svg{height:13cqh}
@keyframes d-wl{to{transform:translateX(-50%)}}
-/* Snow / Rain: two layers of flakes, tiled every 60 or 90 pixels, fall exactly one tile per cycle, so the loop has no seam; the
- near layer is bigger and faster and sways on the way down; a dark row of roofs with lit windows stands in front */
+/* Snow / Rain: two layers of flakes fall exactly one tile height (64 or 96 pixels) per cycle, so the loop has no seam; each flake
+ repeats at its own width, so they form no grid; the near layer is bigger and faster and sways; dark roofs with lit windows in front */
.pv-snowrain{background:radial-gradient(ellipse 70% 45% at 50% 100%,rgba(255,170,90,.13),transparent),linear-gradient(#03050b,#0a1020 50%,#18223a);overflow:hidden}
-.pv-snowrain .sn{position:absolute;left:-10%;right:-10%;top:-60px;bottom:0;background:radial-gradient(circle at 20% 30%,rgba(255,255,255,.7) 1.1px,transparent 1.7px),radial-gradient(circle at 72% 62%,rgba(255,255,255,.55) 1px,transparent 1.6px),radial-gradient(circle at 44% 88%,rgba(255,255,255,.65) 1.1px,transparent 1.7px);background-size:60px 60px;animation:d-sn 6s linear infinite}
-.pv-snowrain .s2{top:-90px;background:radial-gradient(circle at 28% 22%,#fff 2px,transparent 2.6px),radial-gradient(circle at 78% 70%,rgba(255,255,255,.9) 1.7px,transparent 2.3px);background-size:90px 90px;animation:d-sn2 4.2s linear infinite}
+.pv-snowrain .sn{position:absolute;left:-10%;right:-10%;top:-64px;bottom:0;background:radial-gradient(circle at 30% 8%,rgba(255,255,255,.7) 1.1px,transparent 1.7px),radial-gradient(circle at 70% 27%,rgba(255,255,255,.55) 1px,transparent 1.6px),radial-gradient(circle at 20% 46%,rgba(255,255,255,.65) 1.1px,transparent 1.7px),
+ radial-gradient(circle at 60% 69%,rgba(255,255,255,.5) 1px,transparent 1.6px),radial-gradient(circle at 45% 88%,rgba(255,255,255,.7) 1.1px,transparent 1.7px);background-size:53px 64px,67px 64px,79px 64px,97px 64px,61px 64px;animation:d-sn 6s linear infinite}
+.pv-snowrain .s2{top:-96px;background:radial-gradient(circle at 25% 15%,#fff 2px,transparent 2.6px),radial-gradient(circle at 75% 52%,rgba(255,255,255,.9) 1.7px,transparent 2.3px),radial-gradient(circle at 40% 83%,rgba(255,255,255,.85) 1.9px,transparent 2.5px);
+ background-size:89px 96px,113px 96px,131px 96px;animation:d-sn2 4.2s linear infinite}
.pv-snowrain .town{position:absolute;left:0;right:0;bottom:0;height:24%;background:linear-gradient(#f3c26a 0 0) 12% 80%/4px 5px no-repeat,linear-gradient(#f3c26a 0 0) 38% 84%/4px 5px no-repeat,linear-gradient(#f3c26a 0 0) 63% 78%/4px 5px no-repeat,linear-gradient(#f3c26a 0 0) 86% 82%/4px 5px no-repeat,#070a13;
clip-path:polygon(0 100%,0 52%,9% 30%,18% 52%,22% 52%,27% 18%,32% 52%,36% 52%,46% 26%,56% 52%,59% 52%,64% 22%,69% 52%,72% 52%,82% 30%,92% 52%,95% 52%,98% 34%,100% 44%,100% 100%)}
-@keyframes d-sn{to{transform:translateY(60px)}}
-@keyframes d-sn2{50%{transform:translate(5px,45px)}100%{transform:translate(0,90px)}}
+@keyframes d-sn{to{transform:translateY(64px)}}
+@keyframes d-sn2{50%{transform:translate(5px,48px)}100%{transform:translate(0,96px)}}
/* Fireworks: three times per cycle a rocket climbs to a point and a burst opens there, one after another: sixteen rays (a
conic gradient, cut by a radial mask into rays brightest at their tips) grow, droop and fade; a dark skyline stands in front */
.pv-fireworks{background:linear-gradient(#02030a,#0b0c22 55%,#221640);overflow:hidden}