Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Created December 30, 2019 16:15
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 aaizemberg/adfd79145625d1923a1297cf67d9b120 to your computer and use it in GitHub Desktop.
Save aaizemberg/adfd79145625d1923a1297cf67d9b120 to your computer and use it in GitHub Desktop.
p5js @ntsutae birds noise sin cos
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/addons/p5.sound.min.js"></script>
<meta charset="utf-8" />
<meta name="author" content="https://twitter.com/ntsutae/status/1205038586036281346">
<style>
html,
body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}
</style>
</head>
<body>
<script>
function setup() {
createCanvas(F = W = 720, W)
}
function draw() {
background(0)
F++
translate(H = W / 2, H)
scale(0.1)
for (i = 0; i < 480; i++) {
x = (noise(i - F) - 0.5) * 1000
y = H + 80 - i
scale(1.01)
stroke(map(i, 0, 480, 255, 32))
for (j = 2, r = sin((i + F) * 0.1) * PI / 4; j--; r = PI - r)
line(x, y, x + cos(r) * 10, y + sin(r) * 10)
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment