Created
August 23, 2015 16:41
-
-
Save nrshrivatsan/4ad9b316534c82603314 to your computer and use it in GitHub Desktop.
Use math to draw! ;)
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<style> | |
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
</style> | |
</head> | |
<body> | |
<canvas id="myCanvas" width="900" height="900"></canvas> | |
<script> | |
var canvas = document.getElementById('myCanvas'); | |
var context = canvas.getContext('2d'); | |
context.beginPath(); | |
x1 = 100; | |
y1 = 140; | |
x2 = 460; | |
y2 = 50; | |
for (var i = 0; i < 60; i++) { | |
context.beginPath(); | |
context.moveTo(x1, y1); | |
context.lineTo(x2, y2); | |
context.stroke(); | |
x2-=10 | |
y1+=10; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://itisvats.blogspot.com/2015/08/math-beauty.html