Dummy Class.....
in
Programming Questions
•
2 years ago
Hi there,
I'm trying to have a resizable rectangle that acts as a mask over the top waveform, however i just keep on creating new rectangles on top, I'm sure I've just called something wrong somewhere.
- float x,y,ax,ay,bx,by;
- int stRad;
- WFormMask myWFormMask;
- void setup() {
- size(800,800);
- smooth();
- frameRate(60);
- stroke(250);
- background(0);
- stRad=100;
- myWFormMask = new WFormMask(0);
- }
- void draw() {
- int cx = width/2;
- int cy = height/2;
- float r = random(50,100)+random(1,50);
- float buffCircle = TWO_PI/240.0;
- float buffAngle=buffCircle*frameCount;
- float bbuffAngle=buffCircle*(frameCount+1);
- float abuffAngle=buffCircle*(frameCount-1);
- if(buffAngle <= TWO_PI){
- ax = cx + stRad * cos(buffAngle);
- ay = cy + stRad * sin(buffAngle);
- x = cx + r * cos(abuffAngle);
- y = cy + r * sin(abuffAngle);
- bx = cx + stRad * cos(bbuffAngle);
- by = cy + stRad * sin(bbuffAngle);
- beginShape(LINES);
- vertex(ax,ay);
- vertex(x,y);
- vertex(x,y);
- vertex(bx,by);
- endShape();
- }
- float currentHor= (3.33333333333333333333)*frameCount; ///////width/(frameRate*seconds) = 3.3333333333//////
- float acurrentHor= (3.33333333333333333333)*(frameCount+1);
- float bcurrentHor= 3.33333333333333333333*(frameCount-1);
- if (currentHor<=800){
- stroke(250);
- beginShape(LINES);
- vertex(bcurrentHor,stRad);
- vertex(currentHor,r);
- vertex(currentHor,r);
- vertex(acurrentHor,stRad);
- endShape();
- }
- }
- void mousePressed(){
- if(mouseY<=200){
- int mScrubPoint = mouseX;
- myWFormMask.display(mScrubPoint);
- }
- }
- class WFormMask{
- int xpos;
- WFormMask(int tempXpos) {
- xpos = tempXpos;
- }
- void display(int xpos) {
- stroke(0);
- fill(random(0,250));
- rect(0,0,xpos,200);
- }
- }
Miles
1