Skip to content

Commit

Permalink
refactor(examples): update fiber-basics
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 3, 2023
1 parent 4b40903 commit 05bb5d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/fiber-basics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { button, canvas, div } from "@thi.ng/hiccup-html";
import { roundTo } from "@thi.ng/math";
import { SYSTEM } from "@thi.ng/random";
import { $compile } from "@thi.ng/rdom";
import { concat, range, reverse, zip } from "@thi.ng/transducers";
import { range, symmetric, zip } from "@thi.ng/transducers";

const SIZE = 640;

Expand Down Expand Up @@ -51,8 +51,8 @@ const cell = (
false,
true
).take(alpha.length / 2);
// fade out loop
for (let [a, hh] of zip(alpha, concat(height, reverse(height)))) {
// loop to grow/shrink and fade out rect
for (let [a, hh] of zip(alpha, symmetric(height))) {
// add cell rect to scene
scene.children.push(
isHoriz
Expand Down Expand Up @@ -124,7 +124,7 @@ function* endFrame(canvas: HTMLCanvasElement, scene: Group) {
// create main fiber and attach sub-processes
const app = fiber();
// init child processes to create & draw animation
app.forkAll(beginFrame(scene), cellAnim(scene, 400), endFrame(main, scene));
app.forkAll(beginFrame(scene), cellAnim(scene, 500), endFrame(main, scene));
// kick-off
app.run();
})();

0 comments on commit 05bb5d3

Please sign in to comment.