Skip to content

Instantly share code, notes, and snippets.

@giles-cholmondley-durston
Created April 26, 2013 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giles-cholmondley-durston/5468876 to your computer and use it in GitHub Desktop.
Save giles-cholmondley-durston/5468876 to your computer and use it in GitHub Desktop.
verlet-js
{"description":"verlet-js","endpoint":"","display":"canvas","public":true,"require":[{"name":"verlet-js","url":"http://enjalot.github.io/verlet-js/verlet.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":true,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
//verlet-js: http://subprotocol.com/2013/04/18/introducing-verlet-js.html
var width = tributary.sw/2;
var height = tributary.sh/2;
var sim;
tributary.init = function(ctx) {
// simulation
sim = new VerletJS(width, height, tributary.canvas);
sim.friction = 1.015;
// entities
var tire1 = sim.tire(new Vec2(189,115), 32, 15, 0.7, 2);
console.log("sim", sim)
}
tributary.run = function(ctx, t) {
if(sim) {
sim.frame(7);
sim.draw();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment