summaryrefslogtreecommitdiff
path: root/src/engine/utils
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-06 14:35:04 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-06 14:35:04 -0700
commit823620b2a6ebb7ece619991e47a37ad46542b69f (patch)
tree82a1501c5f707a1bcbc6c28bd6d0f5731cc9f618 /src/engine/utils
parentce06fa7c29ba4e3d6137f7aa74fbfe45af0e8b73 (diff)
downloadthe-abstraction-engine-823620b2a6ebb7ece619991e47a37ad46542b69f.tar.gz
the-abstraction-engine-823620b2a6ebb7ece619991e47a37ad46542b69f.zip
add particles
Diffstat (limited to 'src/engine/utils')
-rw-r--r--src/engine/utils/colors.ts22
-rw-r--r--src/engine/utils/index.ts2
-rw-r--r--src/engine/utils/random.ts9
3 files changed, 33 insertions, 0 deletions
diff --git a/src/engine/utils/colors.ts b/src/engine/utils/colors.ts
new file mode 100644
index 0000000..199180c
--- /dev/null
+++ b/src/engine/utils/colors.ts
@@ -0,0 +1,22 @@
+// gruvbox dark
+export const colors = {
+ bg: "#282828",
+ fg: "#ebdbb2",
+ red: "#cc241d",
+ green: "#98971a",
+ yellow: "#d79921",
+ blue: "#458588",
+ purple: "#b16286",
+ aqua: "#689d6a",
+ orange: "#d65d0e",
+ gray: "#a89984",
+ lightGray: "#928374",
+ darkGray: "#3c3836",
+ lightRed: "#fb4934",
+ lightGreen: "#b8bb26",
+ lightYellow: "#fabd2f",
+ lightBlue: "#83a598",
+ lightPurple: "#d3869b",
+ lightAqua: "#8ec07c",
+ lightOrange: "#fe8019",
+};
diff --git a/src/engine/utils/index.ts b/src/engine/utils/index.ts
index 78b600e..48b94b8 100644
--- a/src/engine/utils/index.ts
+++ b/src/engine/utils/index.ts
@@ -2,3 +2,5 @@ export * from "./clamp";
export * from "./dotProduct";
export * from "./rotateVector";
export * from "./modal";
+export * from "./colors";
+export * from "./random";
diff --git a/src/engine/utils/random.ts b/src/engine/utils/random.ts
new file mode 100644
index 0000000..3d9d8b8
--- /dev/null
+++ b/src/engine/utils/random.ts
@@ -0,0 +1,9 @@
+export const normalRandom = (mean: number, stdDev: number, maxStdDevs = 2) => {
+ const [u, v] = [0, 0].map(() => Math.random() + 1e-12);
+ const normal =
+ mean + stdDev * Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
+ return Math.min(
+ mean + maxStdDevs * stdDev,
+ Math.max(mean - maxStdDevs * stdDev, normal),
+ );
+};