From 68184cf0e3d4ce46551108fc23d807aab21e78ac Mon Sep 17 00:00:00 2001 From: mehbark Date: Sat, 2 Dec 2023 22:35:52 -0500 Subject: [PATCH] crash: cool freeze thing --- html/crash.tsx | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 html/crash.tsx diff --git a/html/crash.tsx b/html/crash.tsx new file mode 100644 index 0000000..71c9f26 --- /dev/null +++ b/html/crash.tsx @@ -0,0 +1,102 @@ +import { render_and_copy } from "./common.tsx"; + +const msg = `nice argument dweebus however i have already +used cohost's css capabilities to make an +animation of your post getting hit by a truck and +scattering letters everywhr`.split("\n"); + +// i like the freezing effect, but it's probably not right here; +const explode_transform = () => + `translate3d(${(-Math.random() * 10).toFixed(2)}rem, ${( + (Math.random() - 0.5) * + 20 + ).toFixed(2)}rem, ${((Math.random() - 0.5) * 6).toFixed( + 2 + )}rem) rotate(${Math.random()}turn)`; + +const Line = ({ + children, + width_ratio, + length_s, + delay_s, +}: { + children: string; + width_ratio: number; + length_s: number; + delay_s: number; +}) => ( +
+ {...(() => { + // we're pretending that everything is the same length (we'll see if this works) + const delay_per = (length_s * width_ratio) / children.length; + + return [...children].map((c, i) => ( + + {c} + + )); + })()} +
+); + +const Crash = ({ + vehicle, + msg, + length_s = 2, + delay_s = 0, +}: { + vehicle: string; + msg: string[]; + length_s?: number; + delay_s?: number; +}) => ( +
+
+ + {msg[0]} + + + {msg[1]} + + + {msg[2]} + + + {msg[3]} + +
+
+ {vehicle} +
+
+); + +render_and_copy();