Skip to content

Instantly share code, notes, and snippets.

@reginavetka
Created October 27, 2016 22:02
Show Gist options
  • Select an option

  • Save reginavetka/f12dcfdb23d627c97ac1722230a3f727 to your computer and use it in GitHub Desktop.

Select an option

Save reginavetka/f12dcfdb23d627c97ac1722230a3f727 to your computer and use it in GitHub Desktop.
Wet/Sharp
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Empty project</title>
<script type="text/javascript" src="../rune.js"></script>
<script src="../rune.noise.js"></script>
<style type="text/css">
body {
background-color: #EAEAEA;
}
#canvas svg {
background-color: white;
box-shadow: 0 3px 2px 0 rgba(0, 0, 0, 0.06),inset -1px -1px 1px 0 rgba(0, 0, 0, 0.02);
border: 1px solid #E2E2E2;
border-bottom-color: #CECECE;
}
</style>
</head>
<body>
<div id="canvas"></div>
<script type="text/javascript" src="sketch.js"></script>
</body>
</html>
// This sketch requires you to add Rune.Noise to your HTML page:
// https://github.com/runemadsen/rune.noise.js
var r = new Rune({
container: "#canvas",
width: 600,
height: 770,
debug: true
});
// draw background
r.rect(0, 0, r.width, r.height).fill(255);
r.ellipse(r.width/2, r.height/2, 430,430).fill(false).strokeWidth(100).stroke(0);
r.rect(0, 0, r.width, r.height/3.5).fill(0);
r.rect(0, 600, r.width, r.height/3.5).fill(0);
r.rect(0, 0, 130, r.height).fill(0);
r.rect(470, 0,r.width, r.height).fill(0);
r.rect(0, 560,r.width, r.height).fill(0);
var noise = new Rune.Noise().noiseDetail(0.6);
var numPoints = 100;
var pointDegree = 360 / numPoints;
var radius = 150;
var noiseStep = 200;
for(var i = 0; i < 26; i++) {
var noiseCircle = r.polygon(r.width/2-i/6, r.height/2-i/6)
.stroke(0)
.fill(false)
.strokeWidth(Math.random(0.2,0.7));
radius = 150-i*10;
for(var j = 0; j < numPoints; j++) {
var noiseRadius = (noise.get(noiseStep) * 40) + radius;
var x = Math.cos(Rune.radians(pointDegree * j)) * noiseRadius;
var y = Math.sin(Rune.radians(pointDegree * j)) * noiseRadius;
noiseCircle.lineTo(x, y);
noiseStep += 0.09;
}
}
r.draw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment