Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float angleX = 0;
- float angleY = 100;
- int counter = 1;
- void setup()
- {
- size(200, 200);
- background(0,0,0);
- }
- void draw()
- {
- if(counter > 0)
- {
- angleX++;
- }
- if(angleX == 146)
- {
- counter = counter*-1;
- }
- if(counter < 0)
- {
- angleX--;
- }
- if(angleX == -146)
- {
- counter = counter*-1;
- }
- pushMatrix();
- rotate(radians(45));
- translate(141,-50);
- pushMatrix();
- translate(0,int(angleX));
- rectAngleX(0,100,150,75,0);
- rectAngleX(0,-400,0,0,255);
- for (int i = 0; i < 288; i = i + 16)
- {
- lineValueXY(0,228-i,255,255,255);
- fill(255,255,255);
- text((i/16-9)*10,55,244-i+5);
- }
- text(90,55,-45+5);
- strokeWeight(1);
- stroke(255,255,255);
- line(-200,100,600,100);
- noStroke();
- popMatrix();
- rectAngleX(0,153,150,75,0);
- rectAngleX(0,-452,0,0,255);
- popMatrix();
- pushMatrix();
- rotate(radians(45));
- translate(20,-100);
- degrees();
- popMatrix();
- fill(255,255,255);
- pushMatrix();
- translate(100, 50);
- triangle(0, -35, -15, -20, 15, -20);
- popMatrix();
- noFill();
- lineAngleXY(0,100,255,255,0);
- triangleXY(0,100,255,255,0);
- }
- void rectAngleX(int x, int y,int r, int g, int b)
- {
- fill(r, g, b);
- pushMatrix();
- translate(x, y);
- rect(-200, 0, 600, 500);
- popMatrix();
- }
- void lineAngleXY(int x, int y, int r, int g, int b)
- {
- strokeWeight(4);
- stroke(r, g, b);
- pushMatrix();
- translate(x, y);
- line(25,0,50,0);
- line(150,0,175,0);
- popMatrix();
- noStroke();
- }
- void triangleXY(int x, int y, int r, int g, int b)
- {
- fill(r, g, b);
- pushMatrix();
- translate(x, y);
- triangle(101, 0, 70, 10, 45, 10);
- triangle(99, 0, 130, 10, 155, 10);
- popMatrix();
- }
- void lineValueXY(int x, int y, int r, int g, int b)
- {
- strokeWeight(1);
- stroke(r, g, b);
- pushMatrix();
- translate(x, y);
- line(75,0,125,0);
- line(84,4,116,4);
- line(80,8,120,8);
- line(84,12,116,12);
- line(75,16,125,16);
- popMatrix();
- noStroke();
- }
- void degrees()
- {
- strokeWeight(2);
- stroke(255,255,255);
- noFill();
- arc(100, 50, 100,100,PI, TWO_PI);
- noStroke();
- ///
- pushMatrix();
- translate(100, 50);
- translate(32, -32);
- rotate(radians(-45));
- strokeWeight(2);
- stroke(255,255,255);
- line(0,0,10,0);
- noStroke();
- popMatrix();
- ///
- pushMatrix();
- translate(100, 50);
- strokeWeight(2);
- stroke(255,255,255);
- line(45,0,55,0);
- noStroke();
- popMatrix();
- ///
- pushMatrix();
- translate(100, 50);
- strokeWeight(2);
- stroke(255,255,255);
- line(0,-45,0,-55);
- noStroke();
- popMatrix();
- ///
- pushMatrix();
- translate(100, 50);
- translate(-32, -32);
- rotate(radians(45));
- strokeWeight(2);
- stroke(255,255,255);
- line(0,0,-10,0);
- noStroke();
- popMatrix();
- ///
- pushMatrix();
- translate(100, 50);
- strokeWeight(2);
- stroke(255,255,255);
- line(-45,0,-55,0);
- noStroke();
- popMatrix();
- ///
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement