Skip to content

Instantly share code, notes, and snippets.

View cherdarchuk's full-sized avatar

Joey Cherdarchuk cherdarchuk

View GitHub Profile
@cherdarchuk
cherdarchuk / .block
Last active May 6, 2020 22:56
Choropleth V5
license: gpl-3.0
height: 600
border: no
@cherdarchuk
cherdarchuk / .block
Created March 10, 2018 21:29
geo 2 rect test
license: mit
@cherdarchuk
cherdarchuk / .block
Created January 17, 2018 19:26
Projection Transitions
license: gpl-3.0
@cherdarchuk
cherdarchuk / .block
Created November 27, 2017 22:40
Classed Choropleth
license: gpl-3.0
@cherdarchuk
cherdarchuk / .block
Created June 14, 2017 17:59
Line Intersection Brushing
license: mit
@cherdarchuk
cherdarchuk / .block
Last active November 25, 2016 00:02
Antibiotic Resistance Simulation Simpler Colors
license: mit
@cherdarchuk
cherdarchuk / README.md
Last active June 4, 2016 16:05
Pulse Animations
@cherdarchuk
cherdarchuk / README.md
Last active August 29, 2015 14:10
Breathing square

The breathing square optical illusion. All 5 squares are the same size, however the background square appears to grow and shrink as it rotates even though its size never changes.

@cherdarchuk
cherdarchuk / index.html
Last active August 29, 2015 14:07 — forked from syntagmatic/index.html
Little Black Hole
<!DOCTYPE html>
<meta charset="utf-8">
<canvas id="canvas"></canvas>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var num = 10000;
var canvas = document.getElementById("canvas");
var width = canvas.width = 960;
var height = canvas.height = 500;

Click each shape above to move it to the front.

An ever so slight change to Scott Murray's implementation, to prevent shapes in the middle of the stack from fading back a little before fading to front.

SVG doesn’t include a concept of z-index, layering, or depth, except that elements that exist later in an SVG document are drawn “on top”. But when designing interactive pieces, we often want shapes that the user has selected / clicked / interacted with to be moved “on top,” to prevent occlusion and ensure visibility.

It’s easy to take an element and simply move it to the bottom of its parent container:

var moveToFront = function() {