anim.plane.line

class anim.plane.line(x=0, y=0, position=None, Lx=None, Ly=None, dimension=None, orientation=0, center=False, color='grey', thickness=0.005, linestyle='-', group=None, zvalue=0, draggable=False, clickable=False)

A line item is defined by:

  • position of the point of reference

  • dimensions (Lx and Ly)

  • styling

Parameters ══════════

  • name

    str The line’s name

  • group

    anim.plane.group default: None The line’s group. If None, the position of the reference point is in absolute coordinates. Otherwise, the positions are relative to the group’s reference point.

─── position ────────────────────────────────

  • x

    float default: 0 x-position of the reference point.

  • y

    float default: 0 y-position of the reference point.

  • position

    (float, float), [float, float], complex default: [0,0] Position of the reference point. The user can define either x, y or the position. In case of conflict, the position attribute wins.

  • center

    bool default: False Boolean defining the centering around the reference point.

─── dimensions ──────────────────────────────

  • Lx

    float The line’s width, i.e. length along the x axis when orientation is 0.

  • Ly

    float The line’s height, i.e.length along the y axis when orientation is 0.

  • dimension

    (float, float), [float, float], complex default: [0,0] Dimensions along the x and y axes when orientation is 0. The user must define either Lx, Ly or the dimension array. In case of conflicting definitions, the dimension attribute wins.

─── transformations ─────────────────────────

  • orientation

    float default: 0, unit: radians Orientation of the rectangle, with respect to the positive part of the x-axis.

  • draggable

    bool default: False Boolean specifying if the item can be dragged. If True, the dragging callback is defined in the ‘itemChange’ method of the event class, which is transfered to the canva’s ‘event’ method (recommended).

─── stack ───────────────────────────────────

  • zvalue

    float default: 0 Z-value (stack order) of the line.

─── style ────────────────────────────────

  • color

    None, str, QColor default: ‘grey’ Line color. None stands for transparency.

  • thickness

    float default: 0.005 Line thickness, in scene units. When it is equal to 0, the stroke has the minimal thickness of 1 pixel.

  • linestyle

    ‘solid’/’-’, ‘dash’/’–’, ‘dot’/’..’/’:’, ‘dashdot’/’-.’ default: ‘-’ Line style.

__init__(x=0, y=0, position=None, Lx=None, Ly=None, dimension=None, orientation=0, center=False, color='grey', thickness=0.005, linestyle='-', group=None, zvalue=0, draggable=False, clickable=False)

Path item constructor

Methods

__init__([x, y, position, Lx, Ly, ...])

Path item constructor

initialize()

Initialize the line

rotate(angle)

Relative rotation

setGeometry()

Set the line geometry

setOrientation()

Set the qitem orientation

setPosition([position])

Sets the qitem's position.

setStroke()

Stroke styling

translate(dx[, dy])

Relative translation

Attributes

Lx

Ly

center

center_of_rotation

clickable

color

dimension

draggable

group

linestyle

orientation

position

stroke

thickness

x

y

zvalue