diff options
author | Ryan Schanzenbacher <ryan@rschanz.org> | 2022-12-07 13:40:40 -0500 |
---|---|---|
committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2022-12-07 13:40:40 -0500 |
commit | 931031b46c69410e5985897b429be64dfa4f8993 (patch) | |
tree | d89cd98b3041e9a922cfafce66519ec24f44a500 | |
parent | 7e8e51b591271420572579693d9d4015e8497063 (diff) |
better snow (courtesy of tint @ tint.red)
-rw-r--r-- | themes/hugo-coder/layouts/_default/baseof.html | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/themes/hugo-coder/layouts/_default/baseof.html b/themes/hugo-coder/layouts/_default/baseof.html index 4c28098..8394257 100644 --- a/themes/hugo-coder/layouts/_default/baseof.html +++ b/themes/hugo-coder/layouts/_default/baseof.html | |||
@@ -11,6 +11,35 @@ | |||
11 | {{ partial "csp.html" . }} | 11 | {{ partial "csp.html" . }} |
12 | {{ end }} | 12 | {{ end }} |
13 | 13 | ||
14 | <style> | ||
15 | @keyframes snow { | ||
16 | 0% { | ||
17 | transform: translate(var(--x), var(--y)); | ||
18 | } | ||
19 | 50% { | ||
20 | transform: translate(calc(var(--x) - var(--w)), calc(100vh - 5px)); | ||
21 | } | ||
22 | 100% { | ||
23 | transform: translate(calc(var(--x) - var(--w)), calc(100vh - 5px)) scale(0); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | .snow { | ||
28 | width: 5px; | ||
29 | height: 5px; | ||
30 | border-radius: 50%; | ||
31 | background-color: white; | ||
32 | position: absolute; | ||
33 | transform: translate(var(--x), var(--y)); | ||
34 | animation: snow var(--s) linear var(--d) infinite; | ||
35 | } | ||
36 | |||
37 | body { | ||
38 | overflow: hidden; | ||
39 | } | ||
40 | |||
41 | </style> | ||
42 | |||
14 | {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }} | 43 | {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }} |
15 | <meta name="description" content="{{ .Description | default (.Summary | default .Site.Params.description ) }}"> | 44 | <meta name="description" content="{{ .Description | default (.Summary | default .Site.Params.description ) }}"> |
16 | <meta name="keywords" content="{{ (delimit .Keywords ",") | default .Site.Params.keywords }}"> | 45 | <meta name="keywords" content="{{ (delimit .Keywords ",") | default .Site.Params.keywords }}"> |
@@ -106,6 +135,7 @@ | |||
106 | <!-- | 135 | <!-- |
107 | <div id=fireworksContainer style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none;"></div> | 136 | <div id=fireworksContainer style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none;"></div> |
108 | --> | 137 | --> |
138 | <div id="snow" style="position: absolute; top: 0; left: 0; height: 100vh; width: 100vw; --s: 10s; --w: 50vw; --d: 0s;"></div> | ||
109 | {{ partial "float" . }} | 139 | {{ partial "float" . }} |
110 | <main class="wrapper"> | 140 | <main class="wrapper"> |
111 | {{ partial "header.html" . }} | 141 | {{ partial "header.html" . }} |
@@ -155,7 +185,7 @@ | |||
155 | {{- partial "analytics/googletagmanager" . -}} | 185 | {{- partial "analytics/googletagmanager" . -}} |
156 | {{ end }} | 186 | {{ end }} |
157 | <!-- | 187 | <!-- |
158 | {{ if eq .URL "/" }} | 188 | {{ if eq .RelPermalink "/" }} |
159 | <script src="https://cdn.jsdelivr.net/npm/fireworks-js@latest/dist/fireworks.js"></script> | 189 | <script src="https://cdn.jsdelivr.net/npm/fireworks-js@latest/dist/fireworks.js"></script> |
160 | <script> | 190 | <script> |
161 | const c = document.querySelector("#fireworksContainer") | 191 | const c = document.querySelector("#fireworksContainer") |
@@ -192,7 +222,17 @@ | |||
192 | </script> | 222 | </script> |
193 | {{ end }} | 223 | {{ end }} |
194 | --> | 224 | --> |
195 | <script src="//cdnjs.cloudflare.com/ajax/libs/Snowstorm/20131208/snowstorm-min.js"></script> | 225 | <script> |
196 | <script>snowStorm.followMouse = false;</script> | 226 | function r(min, max) { |
227 | return Math.random() * (max - min) + min; | ||
228 | } | ||
229 | |||
230 | for(const _ of Array(250).fill(0)) { | ||
231 | const el = document.createElement("div"); | ||
232 | el.className = "snow"; | ||
233 | el.style = `--x: ${r(0, 200)}vw; --y: -${r(0, 100)}vh; --d: ${r(-20, 20)}s; --w: ${r(40, 70)}vw; --s: ${r(12, 20)}s;`; | ||
234 | snow.appendChild(el); | ||
235 | } | ||
236 | </script> | ||
197 | </body> | 237 | </body> |
198 | </html> | 238 | </html> |