Skip to content

Instantly share code, notes, and snippets.

@steveharoz
steveharoz / index.html
Last active August 29, 2015 14:24 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<canvas style="width:100%; height:100%"></canvas>
<script>
/* https://github.com/d3/d3-timer Copyright 2015 Mike Bostock */
"undefined"==typeof requestAnimationFrame&&(requestAnimationFrame="undefined"!=typeof window&&(window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame)||function(e){return setTimeout(e,17)}),function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.timer={})}(this,function(e){"use strict";function n(){r=m=0,c=1/0,t(u())}function t(e){if(!r){var t=e-Date.now();t>24?c>e&&(m&&clearTimeout(m),m=setTimeout(n,t),c=e):(m&&(m=clearTimeout(m),c=1/0),r=requestAnimationFrame(n))}}function i(e,n,i){i=null==i?Date.now():+i,null!=n&&(i+=+n);var o={callback:e,time:i,flush:!1,next:null};a?a.next=o:f=o,a=o,t(i)}function o(e,n,t){t=null==t?Date.now():+t,null!=n&&(t+=+n),l.callback=e,l.time=t}function u(e){e=nu
@steveharoz
steveharoz / .gitignore
Last active August 29, 2015 14:22 — forked from mbostock/.block
.DS_Store
node_modules
npm-debug.log
@steveharoz
steveharoz / index.html
Last active August 29, 2015 14:07 — forked from eagereyes/index.html
<!DOCTYPE html>
<html>
<head>
<title>Large Multiples</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
rect {
fill: #ddd;
stroke: none;
}
@steveharoz
steveharoz / README.md
Last active August 29, 2015 14:04 — forked from mbostock/.block
Colorful Rotating Voronoi

I'm just adding a little color to Mike Bostock's demo.

Mario Klingemann has made some beautiful Voronoi diagrams. This is my attempt to recreate them using D3. To achieve the curved cells, each side of the Voronoi polygon is subdivided into three equal-length segments and then joined using the "basis-closed" line interpolator. There are some discontinuities in the animation when the sides of a polygon approach zero which could likely be avoided by adding a minimum-length threshold to the subdivision.

If you’d like to see other instances of this pattern, Mario describes the algorithm on Flickr.

@steveharoz
steveharoz / README.md
Created October 24, 2013 21:45 — forked from mbostock/.block