Skip to content

Instantly share code, notes, and snippets.

@beaugunderson
Last active December 22, 2015 08:18
Show Gist options
  • Save beaugunderson/6443792 to your computer and use it in GitHub Desktop.
Save beaugunderson/6443792 to your computer and use it in GitHub Desktop.
Playing with the ctx in @tmcw's turtle
turtle(function (t) {
ctx.lineWidth = 3;
var fns = [];
[0, 35, 70, 105].forEach(function (a) {
[0, -90, 180, 90, 180].forEach(function (off) {
fns.push(function (t) {
// Originally I just wanted to avoid dense black lines interfering with my ability
// to read the text as I was typing but then figured why not play with opacity
// programatically too?
ctx.strokeStyle = 'rgba(128,128,128,' + Math.abs(Math.sin(t / a)) + ')';
return (Math.sin((t / a)) * 180) + off;
});
});
});
return fns;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment