Skip to content

Instantly share code, notes, and snippets.

@runemadsen
Created November 16, 2015 14:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runemadsen/e026e1fc75d725e7db37 to your computer and use it in GitHub Desktop.
Save runemadsen/e026e1fc75d725e7db37 to your computer and use it in GitHub Desktop.
var r = new Rune({
container: "#canvas",
width: 800,
height: 700,
debug: true
});
// Random
// ---------------------------------------
var randomPath = r.path(100, 50).fill(false)
for(var i = 0; i < 20; i++) {
var x = i * 30;
var y = Rune.random(50);
randomPath.lineTo(x, y);
}
// Modulo
// ---------------------------------------
var moduloPath = r.path(100, 200).fill(false)
for(var i = 0; i < 20; i++) {
var x = i * 30;
var y = (i % 2) * 50;
moduloPath.lineTo(x, y);
}
// Sin
// ---------------------------------------
var sinPath = r.path(100, 350).fill(false)
for(var i = 0; i < 20; i++) {
var x = i * 30;
var y = Math.sin(i / 2) * 25;
sinPath.lineTo(x, y);
}
// Perlin
// ---------------------------------------
var noise = new Rune.Noise();
var perlinPath = r.path(100, 500).fill(false)
for(var i = 0; i < 100; i++) {
var x = i * 5;
var y = noise.get(i * 0.1) * 200;
perlinPath.lineTo(x, y);
}
r.draw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment