TriangleEdgeTreatment

public class TriangleEdgeTreatment
extends EdgeTreatment

java.lang.Object
   ↳ com.google.android.material.shape.EdgeTreatment
     ↳ com.google.android.material.shape.TriangleEdgeTreatment


An edge treatment which draws triangles at the midpoint of an edge, facing into or out of the shape.

Summary

Public constructors

TriangleEdgeTreatment(float size, boolean inside)

Instantiates a triangle treatment of the given size, which faces inward or outward relative to the shape.

Public methods

void getEdgePath(float length, float interpolation, ShapePath shapePath)

Generates a ShapePath for this edge treatment.

Inherited methods

From class com.google.android.material.shape.EdgeTreatment
From class java.lang.Object

Public constructors

TriangleEdgeTreatment

TriangleEdgeTreatment (float size, 
                boolean inside)

Instantiates a triangle treatment of the given size, which faces inward or outward relative to the shape.

Parameters
size float: the length in pixels that the triangle extends into or out of the shape. The length of the side of the triangle coincident with the rest of the edge is 2 * size.

inside boolean: true if the triangle should be "cut out" of the shape (i.e. inward-facing); false if the triangle should extend out of the shape.

Public methods

getEdgePath

void getEdgePath (float length, 
                float interpolation, 
                ShapePath shapePath)

Generates a ShapePath for this edge treatment.

EdgeTreatments have an origin of (0, 0) and a destination of (0, length) (i.e. they represent the top edge), and are be automatically rotated and scaled as necessary when applied to other edges. Only the horizontal, top EdgeTreatment needs to be defined in order to apply it to all four edges.

Parameters
length float: the length of the edge.

interpolation float: the interpolation of the edge treatment. Ranges between 0 (none) and 1 (fully) interpolated. Custom edge treatments can implement interpolation to support shape transition between two arbitrary states. Typically, a value of 0 indicates that the custom edge treatment is not rendered (i.e. that it is a straight line), and a value of 1 indicates that the treatment is fully rendered. Animation between these two values can "heal" or "reveal" an edge treatment.

shapePath ShapePath: the ShapePath that this treatment should write to.