A Pen by cybermarinella on CodePen.
Last active
November 27, 2015 20:35
-
-
Save cybermarinella/73eb83a930b3991091bc to your computer and use it in GitHub Desktop.
Jazz Vampire
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
| <script src="http://cdn.jsdelivr.net/p5.js/latest/p5.min.js"></script> |
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
| fibonacci = 1.61803; | |
| battute = 8; | |
| light = 255; | |
| shadow = 100; | |
| dark = 0; | |
| vampire = dark; | |
| function setup(){ | |
| createCanvas(windowWidth, windowHeight); | |
| background(vampire); | |
| noStroke(); | |
| } | |
| function windowResized() { | |
| resizeCanvas(windowWidth, windowHeight); | |
| } | |
| function draw(){ | |
| catY = mouseX; | |
| catX = mouseX; | |
| console.log(mouseX,mouseY); | |
| var orizzontale = map(mouseX, 0, width, 0, 255); | |
| var verticale = map(mouseY, 255, width, 255, 0); | |
| var spacer = width/8; | |
| for (var x = spacer; x <= height; x+=spacer) { | |
| for (var y = spacer; y <= width; y+=spacer) { | |
| var maxDistance = dist(0,0,height,width); | |
| var size = dist(catY+2,catX,x,y); | |
| fill(x/fibonacci, x/fibonacci, x/fibonacci, 50); | |
| ellipse(y, x, mouseX, mouseX); | |
| size = size / maxDistance * fibonacci; | |
| spacer++; | |
| } | |
| } | |
| for(var x = spacer; x <= width; x+=spacer){ | |
| for(var y = spacer; y <= height/fibonacci; y+=spacer){ | |
| fill(0+mouseY*2,0+mouseY*2,0+mouseY*2, 255/fibonacci) | |
| ellipse(y, x, size*x/battute, size*x/battute); | |
| } | |
| } | |
| for(var x = spacer; x <= width; x+=spacer){ | |
| for(var y = spacer; y <= height; y+=spacer){ | |
| fill(verticale, verticale, verticale, 255/fibonacci); | |
| ellipse(x, y, size*x/battute, size*x/battute); | |
| } | |
| } | |
| for(var x = spacer; x <= width/fibonacci; x+=spacer){ | |
| for(var y = spacer; y <= height; y+=spacer){ | |
| fill(vampire,vampire,vampire, 16); | |
| triangle(x/catX, y+size-width, catX+500, catY+1000, x-width, y-catY ); | |
| } | |
| fill(vampire,vampire,vampire,255/mouseX*3); | |
| rect(0, 0,width,height); | |
| } | |
| } | |
| //http://codepen.io/amritmazumder/pen/ZYRPNz?editors=001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment