Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The window size
- int winW = 600;
- int winH = 600;
- // Angle starting point
- int angle = 0;
- void settings() {
- size(winW, winH, P3D);
- }
- void setup() {
- strokeWeight(0);
- noStroke();
- }
- void draw() {
- background(#ffffff);
- // Big blue ball
- int diameter = 200;
- float xcoord = (float(winW) / 2);
- float ycoord = (float(winH) / 2);
- fill(0, 0, 255);
- ellipse(xcoord, ycoord, diameter, diameter);
- // Male the bar red
- fill(255, 0, 0);
- // Line 1
- int a1 = angle + 10;
- float xcoord2 = sin(radians(a1)) * (diameter * -1) + xcoord;
- float ycoord2 = cos(radians(a1)) * (diameter * -1) + ycoord;
- float xcoord3 = sin(radians(a1)) * (diameter) + xcoord;
- float ycoord3 = cos(radians(a1)) * (diameter) + ycoord;
- // Line 2
- int a2 = angle - 10;
- float xcoord4 = sin(radians(a2)) * (diameter * -1) + xcoord;
- float ycoord4 = cos(radians(a2)) * (diameter * -1) + ycoord;
- float xcoord5 = sin(radians(a2)) * (diameter) + xcoord;
- float ycoord5 = cos(radians(a2)) * (diameter) + ycoord;
- // Spinning bar
- quad(xcoord2, ycoord2, xcoord4, ycoord4, xcoord3, ycoord3, xcoord5, ycoord5);
- // Keeps track of the angle
- angle+=1;
- if (angle >= 360) {
- angle = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement