summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralaric <alaric@netmythos.org>2024-03-30 18:42:07 -0700
committeralaric <alaric@netmythos.org>2024-03-30 18:42:07 -0700
commite8c0b718c0f43204b5f4fd2c7be1ae94017843c1 (patch)
treec55135028e16c0674c957bd50201e114cbd3b9e9
parentdf90271f6c1e4f27e956d5127c753fb884ef7b4d (diff)
downloadcolordots-e8c0b718c0f43204b5f4fd2c7be1ae94017843c1.tar.gz
colordots-e8c0b718c0f43204b5f4fd2c7be1ae94017843c1.zip
We spinnin
-rw-r--r--src/wasm_ttd.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm_ttd.zig b/src/wasm_ttd.zig
index 37352fc..0ccb5a0 100644
--- a/src/wasm_ttd.zig
+++ b/src/wasm_ttd.zig
@@ -350,7 +350,7 @@ const DrawBatch = struct {
webgl.bindBuffer(.array_buffer, circle_program.col_buffer);
webgl.bufferData(.array_buffer, @ptrCast(self.colors), self.len, .dynamic_draw);
- //webgl.drawArraysInstanced(.triangles, 0, circle.len, @intCast(self.len));
+ webgl.drawArraysInstanced(.triangles, 0, circle.len, @intCast(self.len));
webgl.bindVertexArray(line_program.vao);
webgl.useProgram(line_program.prog);
@@ -426,6 +426,7 @@ export fn update(elapsed_time: f32) void {
for (stars[0..sub_count]) |*s| {
s.pdist = s.dist;
s.dist -= speed;
+ s.angle += 0.03;
const plen = lerp(1000, s.initial_len, s.pdist / max_dist);
const psx = (@cos(s.angle) * plen) + width * 0.5;
const psy = (@sin(s.angle) * plen) + height * 0.5;
@@ -433,7 +434,7 @@ export fn update(elapsed_time: f32) void {
const len = lerp(1000, s.initial_len, s.dist / max_dist);
const sx = (@cos(s.angle) * len) + width * 0.5;
const sy = (@sin(s.angle) * len) + height * 0.5;
- const scale = lerp(8, 0, s.dist / max_dist);
+ const scale = lerp(16, 0, s.dist / max_dist);
batch.addInstance(.{ sx, sy }, .{ psx, psy }, s.hue, scale) catch unreachable;
if (batch.len == batch_capacity) {