Skip to content

Instantly share code, notes, and snippets.

Last active April 25, 2017 16:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save syntagmatic/0c3f102903311b51c12a26957c156f27 to your computer and use it in GitHub Desktop.
Lab Color Space Animation
<!DOCTYPE html>
<meta charset="utf-8">
<canvas id="painting" width=960 height=500>
<script src=""></script>
var canvas = document.getElementById("painting");
var ctx = canvas.getContext("2d");
d3.timer(function(elapsed) {
d3.range(0, canvas.width).forEach(function(x) {
var l = 65;
var a = -100+200*x/canvas.width
var b = 100*Math.sin(elapsed/600)
ctx.fillStyle = d3.lab(l,a,b)
ctx.fillRect(x, 0, 1, canvas.height)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment