Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float radius, noiseVal, vari, theta, lx, ly, sz = 5;
- int num = 100, fc;
- float[] scal = new float[num];
- PVector[] dots = new PVector[num];
- boolean save = false;
- float[] noiseVals = new float[num];
- void setup() {
- size(500, 500);
- background(20);
- fill(#FFA41A);
- noFill();
- stroke(#FFA41A);
- strokeWeight(1);
- strokeJoin(ROUND);
- radius = width*.3;
- for (int i=0; i<num; i++) {
- noiseVals[i] = 1+ noise(noiseVal)*.3;
- noiseVal += .5;
- }
- createSpikeyThing();
- }
- void draw() {
- background(20);
- vari = map(sin(theta), -1, 1, 0, 1);
- createSpikeyThing();
- drawSpikeyThing();
- theta += 0.0523;
- if (save) {
- if (frameCount%4==0 && frameCount<fc+121) saveFrame("image-###.gif");
- }
- }
- void createSpikeyThing() {
- float angle = -PI;
- for (int i=0; i<num; i++) {
- if (i<num*vari && i%4==0) {
- scal[i] = noiseVals[i];
- }
- else {
- scal[i] = 1;
- }
- float px = width/2 + sin(angle)*radius*scal[i];
- float py = height/2 + cos(angle)*radius*scal[i];
- dots[i]= new PVector(px, py);
- angle-=TWO_PI/num;
- }
- }
- void drawSpikeyThing() {
- beginShape();
- for (int i=0; i<num; i++) {
- //if (i==0) curveVertex(dots[i].x, dots[i].y);
- curveVertex(dots[i].x, dots[i].y);
- if (i==num-1) curveVertex(dots[i].x, dots[i].y);
- }
- endShape(CLOSE);
- }
- void mouseReleased() {
- noiseVal = random(100);
- for (int i=0; i<num; i++) {
- noiseVals[i] = 1+ noise(noiseVal)*.3;
- noiseVal += .5;
- }
- }
- void keyPressed() {
- fc = frameCount;
- save = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement