I am using a line by using canvas in android as shown below.
canvas.drawLine(100,100,600, 600,mpaint);
I want this line to blink continuously. If anyone know about this, please help me...
I am using a line by using canvas in android as shown below.
canvas.drawLine(100,100,600, 600,mpaint);
I want this line to blink continuously. If anyone know about this, please help me...
To make the line appear to blink you'll have to alternate between to different colors:
Draw red line
Draw blue line
You can simply do this with the following:
boolean blink = false;
// Define paint objects
Paint red = new Paint;
red.setColor(Color.RED);
Paint blue = new Paint;
blue.setColor(Color.BLUE);
In your update method you do this:
if(blink == false) {
blink = true;
}
else {
blink = false;
}
In your rendering method:
if(blink == true) {
canvas.drawLine(100,100,600, 600,red);
}
else {
canvas.drawLine(100,100,600, 600,blue);
}
I hope this helps!