Skip to content

Instantly share code, notes, and snippets.

View newby-jay's full-sized avatar

Jay Newby newby-jay

View GitHub Profile
@newby-jay
newby-jay / index.html
Last active January 1, 2018 15:46 — forked from syntagmatic/index.html
Brownian motion
<style>
html, body { margin: 0; padding: 0;}
</style>
<canvas id="canvas"></canvas>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var num = 1e4;
var canvas = document.getElementById("canvas");
var width = canvas.width = 960;
var height = canvas.height = 500;
@newby-jay
newby-jay / LV.js
Last active August 29, 2015 14:24 — forked from mbostock/.block
Chemical reaction
(function () {
var canvas = document.getElementById("canvas"),
width = canvas.width = 960,
height = canvas.height = 500,
g = canvas.getContext("2d");
var reactionRadius2 = 2,
alpha = 0.007, // fraction of A molecules made per step
gamma = alpha/1.5, // fraction of B molecules that decay per step
randIC = function (i) {
return [width*Math.random(), height*Math.random()];