Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float colUpdate = 0.0;
- float len = PI;
- float freq = .1;
- //Color Variables
- double colR = 0.0;
- double colG = 0.0;
- double colB = 0.0;
- //Color Oscillation Variables
- int colorStart = 128;
- int colorSpan = 127;
- //Arc Position Variables
- double xPos = 0.0;
- double yPos = 0.0;
- //Arc Position Oscillation Variables
- int widthStart = 0;
- int widthSpan = 0;
- int heightStart = 0;
- int heightSpan = 0;
- //Arc Rotation Variables
- double arcAngle1 = 0.0;
- double arcAngle2 = 0.0;
- //Arc Rotation Oscillation variables
- float arcAngle1Start = 0.0;
- float arcAngle1Span = 0.0;
- float arcAngle2Start = 0.0;
- float arcAngle2Span = 0.0;
- void setup(){
- size(1000, 500);
- frameRate(10);
- background(255,255,255);
- }
- void draw(){
- //Misc
- len += 1;
- noFill();
- //Setting Values for Arc Position Oscillation
- widthStart = width/2;
- widthSpan = width/3;
- heightStart = height/2;
- heightSpan = height/3;
- //Setting Values for Arc Rotation Oscillation
- arcAngle1Start = -HALF_PI;
- arcAngle1Span = HALF_PI;
- arcAngle2Start = HALF_PI;
- arcAngle2Span= HALF_PI;
- //Sine Oscillation for Color and Arc Position
- for (int i = 0; i < len; ++i)
- {
- colR = Math.sin(freq*i + 0) * colorSpan + colorStart;
- colG = Math.sin(freq*i + 2) * colorSpan + colorStart;
- colB = Math.sin(freq*i + 4) * colorSpan + colorStart;
- xPos = Math.sin(freq*i) * widthSpan + widthStart;
- yPos = Math.sin((2*freq)*i) * heightSpan + heightStart;
- arcAngle1 = Math.sin(freq*i) * arcAngle1Span + arcAngle1Start;
- arcAngle2 = Math.sin(freq*i) * arcAngle2Span + arcAngle2Start;
- }
- //Choosing Color of Arc Using the Color Doubles Converted to Floats
- stroke(Float.parseFloat(new Double(colR).toString()),Float.parseFloat(new Double(colG).toString()),Float.parseFloat(new Double(colB).toString()));
- //Drawing the Arc Using the Same Float Conversion Method
- arc(Float.parseFloat(new Double(xPos).toString()), Float.parseFloat(new Double(yPos).toString()), 50, 100, Float.parseFloat(new Double(arcAngle1).toString()), Float.parseFloat(new Double(arcAngle2).toString()));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement