Last active
December 22, 2015 08:18
-
-
Save beaugunderson/6443792 to your computer and use it in GitHub Desktop.
Playing with the ctx in @tmcw's turtle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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