2023-07-10 16:51:04 -04:00
|
|
|
import { Main } from "./common.tsx";
|
2023-07-10 16:50:36 -04:00
|
|
|
import { Html, debug_render, render } from "./html.ts";
|
2023-07-10 14:52:20 -04:00
|
|
|
import { Component } from "./jsx/jsx-runtime.ts";
|
|
|
|
|
2023-07-10 14:57:18 -04:00
|
|
|
const peopleify = (...people: string[]): string[] =>
|
|
|
|
people.map(p => `${p} people`);
|
|
|
|
|
2023-07-10 15:57:51 -04:00
|
|
|
const animation_length = (num_items: number): number => num_items / 5;
|
|
|
|
|
2023-07-10 16:50:36 -04:00
|
|
|
const wheel_style = (num_items: number): string =>
|
2023-07-10 15:57:51 -04:00
|
|
|
`transform: translateY(calc(2rem * -${num_items})); animation: ${animation_length(
|
|
|
|
num_items
|
2023-07-10 16:50:36 -04:00
|
|
|
)}s ease-in-out reverse none running spin;`;
|
2023-07-10 15:57:51 -04:00
|
|
|
|
|
|
|
const get_delays = (...lengths: number[]): number[] => {
|
|
|
|
let out = [0];
|
|
|
|
for (const l of lengths) {
|
|
|
|
out.push((out.at(-1) ?? 0) + animation_length(l));
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
};
|
2023-07-10 16:50:36 -04:00
|
|
|
|
|
|
|
const Wheel: Component = ({ items }, _) => (
|
|
|
|
<details class="wheel">
|
|
|
|
<summary>
|
|
|
|
{...items.map((i: string) => <div class="wheel-item">{i}</div>)}
|
|
|
|
</summary>
|
|
|
|
<div class="wheel-inner" style={wheel_style(items.length)}>
|
|
|
|
{/* <div class="wheel-item empty"></div> */}
|
|
|
|
{...items.map((i: string) => <div class="wheel-item">{i}</div>)}
|
2023-07-10 15:57:51 -04:00
|
|
|
</div>
|
2023-07-10 16:50:36 -04:00
|
|
|
</details>
|
2023-07-10 14:52:20 -04:00
|
|
|
);
|
|
|
|
|
2023-07-10 15:57:51 -04:00
|
|
|
// i'll probably just hardcode the delays... lame but w/e
|
2023-07-10 16:50:36 -04:00
|
|
|
const Take: Component = ({ subjects, objects, adjectives }, _) => (
|
|
|
|
<div class="take">
|
|
|
|
<Wheel items={subjects} /> <div class="bridge">who eat</div>{" "}
|
|
|
|
<Wheel items={objects} /> <div class="bridge">are</div>{" "}
|
|
|
|
<Wheel items={adjectives} />
|
|
|
|
</div>
|
|
|
|
);
|
2023-07-10 14:52:20 -04:00
|
|
|
|
|
|
|
// might want to have the final item be seperate
|
2023-07-10 15:57:51 -04:00
|
|
|
// turned out to be unnecessary
|
2023-07-10 14:52:20 -04:00
|
|
|
debug_render(
|
2023-07-10 16:51:04 -04:00
|
|
|
<Main>
|
|
|
|
<Take
|
|
|
|
subjects={peopleify(
|
|
|
|
"poor",
|
|
|
|
"fat",
|
|
|
|
"dumb",
|
|
|
|
"tall",
|
|
|
|
"short",
|
|
|
|
"poor",
|
|
|
|
"fat",
|
|
|
|
"dumb",
|
|
|
|
"tall",
|
|
|
|
"hot"
|
|
|
|
)}
|
|
|
|
objects={[
|
|
|
|
"apples",
|
|
|
|
"bread",
|
|
|
|
"pasta",
|
|
|
|
"candy",
|
|
|
|
"rice",
|
|
|
|
"beans",
|
|
|
|
"apples",
|
|
|
|
"bread",
|
|
|
|
"candy",
|
|
|
|
"rice",
|
|
|
|
"beans",
|
|
|
|
"apples",
|
|
|
|
"bread",
|
|
|
|
"pasta",
|
|
|
|
"candy",
|
|
|
|
"rice",
|
|
|
|
"croissants",
|
|
|
|
]}
|
|
|
|
adjectives={[
|
|
|
|
"vibes",
|
|
|
|
"mean",
|
|
|
|
"dumb",
|
|
|
|
"cool",
|
|
|
|
"hot",
|
|
|
|
"stupid",
|
|
|
|
"funny",
|
|
|
|
"vibes",
|
|
|
|
"mean",
|
|
|
|
"dumb",
|
|
|
|
"cool",
|
|
|
|
"hot",
|
|
|
|
"stupid",
|
|
|
|
"dangerous",
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</Main>
|
2023-07-10 14:52:20 -04:00
|
|
|
);
|