movis.layer.drawing.Line#

class movis.layer.drawing.Line(size: tuple[int, int] = (100, 100), start: tuple[float, float] | ndarray = (0.0, 0.0), end: tuple[float, float] | ndarray = (100.0, 100.0), color: tuple[int, int, int] | str = (255, 255, 255), width: float = 1.0, duration: float = 1000000.0)[source]#

Draw a line from start to end.

Args:
size:

The size of the canvas with a tuple of (width, height).

start:

The start point of the line with a tuple of (x, y).

end:

The end point of the line with a tuple of (x, y).

color:

The color of the line with a tuple of (r, g, b) or a string representing a color name (e.g., "#ff0000" or "red").

width:

The width of the line.

duration:

The duration for which the line should be displayed.

Animateable Attributes:
trim_start

The start point of the line to be drawn in the range of [0, 1]. The default value is 0.

trim_end

The end point of the line to be drawn in the range of [0, 1]. The default value is 1.

start end color width

These attributes can be animated as well.

Methods

get_key(time: float) tuple[Hashable, ...]#

Returns a tuple of hashable values that represent the state of the instance at a given time.

Attributes

attributes

A dictionary of attributes that are used to generate cache keys.

duration