0 Replies - 200 Views - Last Post: 16 April 2013 - 06:03 PM

#1 mouthwash  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 12-February 13

creating a line with a "laser effect"

Posted 16 April 2013 - 06:03 PM

I have something like this:
public class Line extends View{
	public float startX;
    public float startY;
    public float stopX;
    public float stopY;
    Paint paint = new Paint();
    public Line(Context context,float astartX,float astartY,float astopX,float astopY) {
		paint.setPathEffect(new CornerPathEffect(10));
		startX = astartX;
		startY = astartY;
		stopX = astopX;
		stopY = astopY;

	public void onDraw(Canvas canvas){
		canvas.drawLine(startX, startY, stopX, stopY, paint);

which draws a straight line,flat blue, from one point to another. This works completely fine, except I want to add something to make the line look like something to this effect:
Posted Image
I attempted to use the shader library with a linear gradient but couldn't figure out how it works.
Maybe I could use opengl shaders to do this?

This post has been edited by mouthwash: 16 April 2013 - 06:13 PM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1