0 Replies - 107 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

Hi
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) {
		super(context);
		paint.setColor(Color.BLUE);
		paint.setDither(true);
		paint.setStyle(Paint.Style.STROKE);
		paint.setStrokeJoin(Paint.Join.ROUND);
		paint.setStrokeCap(Paint.Cap.ROUND);
		paint.setPathEffect(new CornerPathEffect(10));
		paint.setAntiAlias(true);		
		paint.setStrokeWidth(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