Created
November 29, 2016 15:21
-
-
Save runemadsen/042b04e13adee7eb91c6b2a97d232265 to your computer and use it in GitHub Desktop.
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
// This example requires you to add TweenLite.js and Easepack.js to your HTML file. | |
var r = new Rune({ | |
container: "#canvas", | |
width: 800, | |
height: 600 | |
}); | |
function drawTile(x, y) { | |
var down = r.random(1) > 0.5; | |
var rot = down ? 90 : 0; | |
// Draw something | |
r.rect(x, y, 50, 50); | |
r.line(x + 25, y, x + 25, y + 25).rotate(rot, x + 25, y + 25); | |
r.line(x + 25, y + 25, x + 50, y + 25).rotate(rot, x + 25, y + 25); | |
// pick a direction | |
if(x < r.width && y < r.height) { | |
if(down) { | |
drawTile(x, y + 50, 0); | |
} | |
else { | |
drawTile(x + 50, y, 0); | |
} | |
} | |
} | |
drawTile(0, 0); | |
r.play(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment