// only for video recording! //import processing.video.*; //MovieMaker mm; int IWidth = 600; int IHeight = 400; float TranslY = 0.35*IHeight; float TranslX = 0.2*IWidth; float ScaleFactor = 0.5; float CurrentScale = 0.5; int NumPoints = 500; float nPf = float(NumPoints); float BaseOrbitalSpeed = -0.01; float BaseOrbitalPhaseSpeed = 0.002; float PointOrbitPhaseStrength = 0.57; float BasePivotStrength = 0.131; float PivotUndulationSpeed = 0.033; float PivotUndulationStrength = 0.105; float NoiseScale =23.2; float NoiseAngleDepth = 0.58; float NoiseTraverseSpeed = 0.001; float NoiseTraverser=20.01; float PointAngleTwist=0.19; float PointAngleTwistRandom=0.205; // The Scale Is Minus One to One. In the end X and Y for each point are added one and multiplied by half IWidth and IHeight. // 0.0 is the natural center. Orbiting And Angular Motion are calculated in that order. float[] PointAngle = new float[NumPoints]; float[] PointVel = new float[NumPoints]; float[] PointOldX = new float[NumPoints]; float[] PointOldY = new float[NumPoints]; float[] PointX = new float[NumPoints]; float[] PointY = new float[NumPoints]; float[] PointOrbitPhase = new float[NumPoints]; float[] PointOrbitRotation = new float[NumPoints]; float[] PointOrbitLazy = new float[NumPoints]; float[] PointPivotPhase = new float[NumPoints]; int blurcycle =0; void setup() { size(600, 500); colorMode(HSB, 255, 255, 255, 255); // for movie recording only! // mm = new MovieMaker(this, width, height, "RenderCitric.mov", // 30, MovieMaker.H263, MovieMaker.HIGH); color bgalpha = color(10, 91, 70, 244); background(bgalpha); smooth(); for(int x=0; x < NumPoints; x++){ float Xf = float(x); float xMultip = 1/(nPf-1)*Xf; // PointOrbitPhase[x]= xMultip; PointOrbitPhase[x]= 1; PointAngle[x] = 1; PointVel[x] = 0.02; PointOrbitRotation[x]=TWO_PI*xMultip; PointOldY[x] = 0; PointOldY[x] = 0; PointX[x] = 0; PointY[x] = 0; PointPivotPhase[x] =1; } } void draw() { // movie record! // mm.addFrame(); // MAD ASS BLUR activated by a firm mouse press! if (blurcycle==1 ){ filter(BLUR, 1); } if (mousePressed && blurcycle==0) { blurcycle=1; } else if (mousePressed && blurcycle==1) { blurcycle=0; } //Stupid Pump Zoom! // CurrentScale += 0.0003; // if (CurrentScale>1){ // CurrentScale -= 1; // } // ScaleFactor = 0.6 * sin(CurrentScale*TWO_PI) + 0.2; // dye the bg // background(30); fast solid color bgalpha = color(130, 10, 130, 1); fill(bgalpha); rect(0, 0, IWidth, IHeight+100); // deal with each point for(int x=0; x < NumPoints; x++){ // For Advanced Stroke Rendering I Grab the Old Values.... PointOldX[x]=PointX[x]; PointOldY[x]=PointY[x]; // // Orbit. // float Distance = PointOrbitPhaseStrength*abs(sin(TWO_PI*PointOrbitPhase[x])+1)/2+1-PointOrbitPhaseStrength; PointOrbitRotation[x] += BaseOrbitalSpeed; PointOrbitPhase[x] += BaseOrbitalPhaseSpeed; // Retain angle within 1 if (PointOrbitPhase[x]>1){ PointOrbitPhase[x] -= 1; } if (PointOrbitPhase[x]<-1){ PointOrbitPhase[x] += 2; } // Retain angle within 2PI if (PointOrbitRotation[x]>TWO_PI){ PointOrbitRotation[x] -= TWO_PI; } if (PointOrbitRotation[x]<0){ PointOrbitRotation[x] += TWO_PI; } float PivotX = sin(PointOrbitRotation[x])*Distance; float PivotY = cos(PointOrbitRotation[x])*Distance; // That's the Pivot of our new Point Attractor. // Okay. So, the points, the actual points, they are SERIOUSLY attracted to the pivot (later to each other, too) but want to travel in chaotic paths. float distanceX=PivotX-PointX[x]; float distanceY=PivotY-PointY[x]; float distance=sqrt(sq(distanceY)+sq(distanceX)); // Attraction Strength and how angular phase lessens it's pull and distance makes it more effective. float Xf = float(x); PointPivotPhase[x] += PivotUndulationSpeed * (0.2*1/nPf*Xf); if (PointPivotPhase[x]>1){ PointPivotPhase[x] -= 1; } if (PointPivotPhase[x]<0){ PointPivotPhase[x] += 1; } float PivotStrengthUndulation = abs(sin(TWO_PI*PointPivotPhase[x])+1)/2; float AttractionStrength=distance*BasePivotStrength-PivotUndulationStrength*PivotStrengthUndulation; // Also, each point has an angle depending on which point of the Noise Field Underlaying the Scene it is on. noiseDetail(4,0.65f); PointAngle[x] += PointAngleTwist+random(PointAngleTwistRandom); float NoiseAffect = noise(PointX[x]*NoiseScale,PointY[x]*NoiseScale,NoiseTraverser); PointAngle[x]= ((1-NoiseAngleDepth)*PointAngle[x] + NoiseAngleDepth*NoiseAffect*TWO_PI)/2; float SpeedNoise = 0.5+0.9*noise(PointX[x]*NoiseScale+5,PointY[x]*NoiseScale+5,NoiseTraverser+5); float MoVelX = cos(PointAngle[x])*PointVel[x]*SpeedNoise; float MoVelY = sin(PointAngle[x])*PointVel[x]*SpeedNoise; // Move' Em PointX[x] += AttractionStrength*distanceX +0.5*MoVelX; PointY[x] += AttractionStrength*distanceY +0.5*MoVelY; strokeWeight(0.1+2.5*NoiseAffect); // draw a line from old point to new. Later these should be strokes. float hueWish = 255*PointPivotPhase[x]; // Rainbow! float satWish = 55; float valWish = 255*PointPivotPhase[x]; float aWish = 255; float distanceEffect = constrain(distance, 1, 250); float newA = (aWish+distanceEffect)/1; float newH = (hueWish + PointOrbitPhase[x]*360)/2; color Rainbowz=color(newH,satWish,valWish,newA); stroke(Rainbowz); //strokeWeight(3); line(PointOldX[x]*IWidth*ScaleFactor+TranslX, PointOldY[x]*IHeight*ScaleFactor+TranslY, PointX[x]*IWidth*ScaleFactor+TranslX ,PointY[x]*IHeight*ScaleFactor+TranslY); Rainbowz=color(newH,satWish+11,valWish,newA); stroke(Rainbowz); line((1-PointOldX[x])*IWidth*ScaleFactor+TranslX, (1-PointOldY[x])*IHeight*ScaleFactor+TranslY, (1-PointX[x])*IWidth*ScaleFactor+TranslX ,(1-PointY[x])*IHeight*ScaleFactor+TranslY); newH = 180*PointPivotPhase[x]; Rainbowz=color(newH,88,valWish*2.3,66); stroke(Rainbowz); strokeWeight(2); point (PointX[x]*IWidth*ScaleFactor+TranslX, PointY[x]*IHeight*ScaleFactor+TranslY); // point(PivotX*IWidth*ScaleFactor+TranslX, PivotY*IHeight*ScaleFactor+TranslY); point ((1-PointX[x])*IWidth*ScaleFactor+TranslX, (1-PointY[x])*IHeight*ScaleFactor+TranslY); // paint Neighbours?! // strokeWeight(2); //if (x>0){ //line(PointOldX[x-1]*IWidth*ScaleFactor+TranslX, PointOldY[x-1]*IHeight*ScaleFactor+TranslY, PointOldX[x]*IWidth*ScaleFactor+TranslX ,PointOldY[x]*IHeight*ScaleFactor+TranslY); //line(PointX[x-1]*IWidth*ScaleFactor+TranslX, PointY[x-1]*IHeight*ScaleFactor+TranslY, PointX[x]*IWidth*ScaleFactor+TranslX ,PointY[x]*IHeight*ScaleFactor+TranslY); //} else { // line(PointOldX[NumPoints-1]*IWidth*ScaleFactor+TranslX, PointOldY[NumPoints-1]*IHeight*ScaleFactor+TranslY, PointOldX[x]*IWidth*ScaleFactor+TranslX, PointOldY[x]*IHeight*ScaleFactor+TranslY); // line(PointX[NumPoints-1]*IWidth*ScaleFactor+TranslX, PointY[NumPoints-1]*IHeight*ScaleFactor+TranslY, PointX[x]*IWidth*ScaleFactor+TranslX, PointY[x]*IHeight*ScaleFactor+TranslY); //} NoiseTraverser += NoiseTraverseSpeed; } // Light and Post Effects!!! // Note: HSB Color Mode for those Rainbow-Tastic Effects color bgalphab = color(160, 20, 170, 2); fill(bgalphab); noStroke(); rect(0, 0, IWidth, IHeight+100); // Text and UI // PFont solly; // solly = loadFont("Solly-24.vlw"); //textFont(solly, 24); // some variables // color textcol = color(13, 20, 250, 44); // fill(textcol); //text(PointOrbitPhase[3], 15, 50); //text(PointOrbitPhase[9], 15, 80); //text(PointOrbitPhase[15], 15, 110); //text(PointX[9], 15, 140); // POST } // movie record stop //void keyPressed() { // if (key == ' ') { // mm.finish(); // Finish the movie if space bar is pressed! // } //}