Created
December 30, 2019 16:15
-
-
Save aaizemberg/adfd79145625d1923a1297cf67d9b120 to your computer and use it in GitHub Desktop.
p5js @ntsutae birds noise sin cos
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
<!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