Skip to content

Instantly share code, notes, and snippets.

@1wheel
1wheel / .gitignore
Last active May 12, 2018 04:10
msi-4096
node_modules
@1wheel
1wheel / README.md
Last active November 28, 2019 02:13
record-movies
@1wheel
1wheel / .gistup
Last active March 27, 2018 18:04
ladder-sm
gistup
@1wheel
1wheel / README.md
Last active January 1, 2020 15:33
regl-ladder-2

Passing arrays of attributes:

attributes: {
  p: () => data.map(({x, y1, dy, isB, speed}) => 
    [x, y1, dy + isB, speed]
  ),
},
@1wheel
1wheel / README.md
Created March 16, 2018 15:40
laggy-pattern-fill

Why is moving a rect with a pattern fill so laggy?

My laptop can animating 1000 solid rects at 60 fps, but 30 pattern filled rects slows down to 10 fps!

@1wheel
1wheel / README.md
Last active January 22, 2020 03:19
regl-ladder

Rough draft of this chart.

We started out with a SVG animation, tried out Elijah's canvas sankey particles and ended up rewriting in regl to get more dots on the screen.

The final version gets better performance by passing in array of attibutes to the vertex shader - I'm not sure why that is.

Update: Ricky Reusser points out that I was creating a new array of points every frame with:

attributes: {x: () => data.map(d => d.x)}

@1wheel
1wheel / .block
Last active January 1, 2020 10:33
closest-county
license: gpl-3.0
height: 600
scrolling: no
border: yes
@1wheel
1wheel / README.md
Last active March 18, 2024 22:22
rounded-corner-curve

Levin Dixon asked how to create a path with rounded corners. The provided curves in d3 adjust the entire path, not just area around the data points.

This might look a better with an A command instead of C, but circles are hard.

@1wheel
1wheel / README.md
Created March 3, 2018 05:24
flying-beeswarm

See beeswarm-path for a tidier implementation of beeswarm along a path.

@1wheel
1wheel / README.md
Created March 2, 2018 13:09
beeswarm-path

Beeswarm along a path, suggested by Arman.