Skip to content

Instantly share code, notes, and snippets.

@runemadsen
Created November 29, 2016 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runemadsen/042b04e13adee7eb91c6b2a97d232265 to your computer and use it in GitHub Desktop.
Save runemadsen/042b04e13adee7eb91c6b2a97d232265 to your computer and use it in GitHub Desktop.
// 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