Draw XXL documentation


Lines as objects

Draw XXL mainly acts as static drawing library. That means you can use the draw functions without any setup with only one line of code. The lines don't persist in the scene but are gone as soon as you stop calling the static draw function. When you animate a line style this paradigm brings disadvantages, because the lines do not know of each other. When you continuously draw a line in Update() it looks like it is the same line. But actually you draw the line newly each time, and the different lines don't know the state of their predecessors and successors. When the animation speed is constant then there is no problem, because a static line can assume that their predecessor and successor will use the same animation speed. Though as soon as the animation speed changes this doesn't work anymore. Therefore: With the approach of static line drawing no smooth fading of animation speed is possible. This is where the here explained "Lines as objects" approach comes in.

If you still want animated line styles with smooth animation speed fading you can create the lines as objects. You will have to declare them as members of your class first and construct them as a required step that the normal static approach doesn't have. After they are construced the actual drawing is easy: The line objects have a function called "Draw()" without any parameters. The line objects have members like "color", "text", "width" and more, so they exactly match the parameters of the static version.

A usage pattern is like this:
		
    Line_fadeableAnimSpeed myLine; //declaring the line object	
    	
    void Start()	
    {	
        myLine = new Line_fadeableAnimSpeed(startPosition, endPosition); //constructing the line	
    }	
	
    void Update()	
    {	
        //Changing some parameters:	
        myLine.color = Color.red;	
        myLine.text = "animation test line";	
        myLine.animationSpeed = Mathf.Sin(Time.time); //The animation does now correctly fade its speed	
	
        myLine.Draw(); //drawing the line	
    }	
			

The following static line objects are available. The names match the names of the corresponding static draw functions except that they also contain a "_fadeableAnimSpeed".

For 3D worldspace:
Name
Line_fadeableAnimSpeed
Ray_fadeableAnimSpeed
LineFrom_fadeableAnimSpeed
LineTo_fadeableAnimSpeed
LineWithAlternatingColors_fadeableAnimSpeed
RayWithAlternatingColors_fadeableAnimSpeed
MovingArrowsLine_fadeableAnimSpeed
MovingArrowsRay_fadeableAnimSpeed

For 2D:
Name
Line_fadeableAnimSpeed_2D
Ray_fadeableAnimSpeed_2D
LineFrom_fadeableAnimSpeed_2D
LineTo_fadeableAnimSpeed_2D
LineWithAlternatingColors_fadeableAnimSpeed_2D
RayWithAlternatingColors_fadeableAnimSpeed_2D
MovingArrowsLine_fadeableAnimSpeed_2D
MovingArrowsRay_fadeableAnimSpeed_2D

For screenspace:
Name
Line_fadeableAnimSpeed_screenspace
Ray_fadeableAnimSpeed_screenspace
LineFrom_fadeableAnimSpeed_screenspace
LineTo_fadeableAnimSpeed_screenspace
LineWithAlternatingColors_fadeableAnimSpeed_screenspace
RayWithAlternatingColors_fadeableAnimSpeed_screenspace
MovingArrowsLine_fadeableAnimSpeed_screenspace
MovingArrowsRay_fadeableAnimSpeed_screenspace