Does any one no how to draw a dotted line with from particular orgin to cureent location of mouseX and mouseY?
in
Programming Questions
•
2 years ago
hi m jst wondering if someone might no it. The deal is , i want to draw a dotted line from orgin , x=width/2 and y=height to current mouse location. window size would be (600,600). Here is my program but it isnt right. my goal is to draw a dotted line whenever i move my mouse to current mouseX and mouseY location. Follwing is my code.
void setup()
{
background(255);
size(600,600);
smooth();
}
void draw()
{
}
void mouseMoved()
{
background(255);
int i = height,x = width/2;
for(i=height;i>=mouseY || x<=mouseX ;i-=5)
{
//fill(255,0,0);
line(x,i,x+=5,i-=5);
x += 5;
}
}
void setup()
{
background(255);
size(600,600);
smooth();
}
void draw()
{
}
void mouseMoved()
{
background(255);
int i = height,x = width/2;
for(i=height;i>=mouseY || x<=mouseX ;i-=5)
{
//fill(255,0,0);
line(x,i,x+=5,i-=5);
x += 5;
}
}
1
