Objects

Shapes, groups, images, SVG and mass objects (points, vector fields, stream lines).

Contents:

  • k.Circle: Circle of radius r, centered on its position.
  • k.Dot: Filled dot (default radius 0.08), with no stroke.
  • k.Ellipse: Ellipse of width w and height h, centered on its position.
  • k.Rect: Rectangle of width w and height h, centered on its position; radius= rounds the corners (for rounded corners prefer k.RoundedRect).
  • k.RoundedRect: Rectangle with rounded corners (radius=0.15 by default).
  • k.Square: Square with side side, centered on its position.
  • k.Polygon: Polygon from its vertices (k.Polygon((0, 0), (2, 0), (1, 1))), centered on its bounding box.
  • k.Triangle: Triangle from its three vertices (no arguments: equilateral with radius 1).
  • k.Line: Segment from start to end (local coordinates), or centered with length=.
  • k.Arrow: Arrow from start to end with a tip of size tip.
  • k.Arc: Circular arc of radius r, starting at start_angle and sweeping angle degrees (counterclockwise).
  • k.Path: Path from SVG commands (d="M 0 0 L 1 1") or a polyline from a list of points; closed=True closes the outline.
  • k.union: Boolean operations between shapes: k.union(a, b), k.intersect(a, b) and k.subtract(a, b) return a new k.Path computed from the outlines at the cursor (with the style of a, unless another one is passed).
  • k.intersect: Shape covering both a and b.
  • k.subtract: a with b cut out.
  • k.Bar: A value shown as a bar that grows from its base, with an optional label (label=True).
  • k.Group: Groups objects: transforms compose and opacity multiplies.
  • k.Image: Raster image (PNG or JPEG) drawn by the renderer, centered on its position.
  • k.SVG: Imports an SVG illustration (a file or inline markup): each shape becomes a k.Path with the SVG's fill, stroke and stroke width, and each <g> becomes a k.Group.
  • k.Brace: Curly brace (}) along one side of an object's box: direction= "down", "up", "left" or "right", gap units away from it, with the tip pointing outward.
  • k.Points: Thousands of points in a single object, batch-drawn in the core.
  • k.VectorField: Arrows of a field fn(x, y) -> (vx, vy) on a grid with density columns across the width of the region (x_range, y_range).
  • k.StreamLines: Streamlines of a field (a k.VectorField or a function), integrated with RK4 in the core from seeds (a count or points).

Back to the reference index.

k.Circle (class)

k.Circle(r: FloatVal = 1.0, **props: Unpack[StyleKeywords])

Circle of radius r, centered on its position. Like every shape, it accepts the style props color (shorthand for stroke and fill), fill, fill_opacity, stroke, stroke_width, dash and the transform props.

Parameters:

Name Type Default Description
r FloatVal 1.0 Circle of radius r, centered on its position.
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
r float 1.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def circle(s: k.Scene):
    c = k.Circle(r=1.2, stroke=k.BLUE, fill=k.BLUE, fill_opacity=0.3).place(at="center")
    s.play(k.draw(c))
    s.play(c.to(r=2))

See also: k.Dot, k.Ellipse, k.Arc.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Dot (class)

k.Dot(r: FloatVal = 0.08, **props: Unpack[StyleKeywords])

Filled dot (default radius 0.08), with no stroke. It is the marker used in charts and for points that follow curves.

Parameters:

Name Type Default Description
r FloatVal 0.08
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 1.0 linear
stroke color theme.fg linear
stroke_width float 0.0 linear
dash floats () step_end
r float 0.08 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def dots(s: k.Scene):
    a = k.Dot(r=0.15, fill=k.RED).place(at="center")
    label = k.Text("P").place(above=a, gap=0.2)
    s.play(k.fade_in(a, label))
    s.wait(0.5)

See also: k.Circle, curve.point_at.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Ellipse (class)

k.Ellipse(w: FloatVal = 2.0, h: FloatVal = 1.0, **props: Unpack[StyleKeywords])

Ellipse of width w and height h, centered on its position.

Parameters:

Name Type Default Description
w FloatVal 2.0 Ellipse of width w and height h, centered on its position.
h FloatVal 1.0 Ellipse of width w and height h, centered on its position.
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
w float 2.0 linear
h float 1.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def ellipse(s: k.Scene):
    e = k.Ellipse(w=4, h=2, stroke=k.PURPLE).place(at="center")
    s.play(k.draw(e))
    s.play(e.to(w=2, h=3))

See also: k.Circle.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Rect (class)

k.Rect(w: FloatVal = 2.0, h: FloatVal = 1.0, **props: Unpack[RectKeywords])

Rectangle of width w and height h, centered on its position; radius= rounds the corners (for rounded corners prefer k.RoundedRect).

Parameters:

Name Type Default Description
w FloatVal 2.0 Rectangle of width w and height h, centered on its position; radius= rounds the corners (for rounded corners prefer k.RoundedRect).
h FloatVal 1.0 Rectangle of width w and height h, centered on its position; radius= rounds the corners (for rounded corners prefer k.RoundedRect).
**props Unpack[RectKeywords] variadic Keyword arguments (RectKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal, radius: FloatVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
w float 2.0 linear
h float 1.0 linear
radius float 0.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def rectangle(s: k.Scene):
    r = k.Rect(w=4, h=2, fill=k.GREEN, fill_opacity=0.3).place(at="center")
    s.play(k.draw(r))
    s.play(r.to(w=6))

See also: k.RoundedRect, k.Square.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.RoundedRect (class)

k.RoundedRect(
    w: FloatVal = 2.0,
    h: FloatVal = 1.0,
    radius: FloatVal = 0.15,
    **props: Unpack[StyleKeywords],
)

Rectangle with rounded corners (radius=0.15 by default). Good for boxes and cards with text inside.

Parameters:

Name Type Default Description
w FloatVal 2.0
h FloatVal 1.0
radius FloatVal 0.15 Rectangle with rounded corners (radius=0.15 by default).
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props inherited from k.Rect: fill, fill_opacity, stroke, stroke_width, dash, w, h, radius.

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def card(s: k.Scene):
    box = k.RoundedRect(w=4, h=2.4, radius=0.3).place(at="center")
    title = k.Text("Card").place(inside=box, align="top", pad=0.3)
    s.play(k.draw(box), k.write(title))
    s.wait(0.5)

See also: k.Rect, obj.place.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Square (class)

k.Square(side: FloatVal = 1.0, **props: Unpack[RectKeywords])

Square with side side, centered on its position. It is a k.Rect with w == h.

Parameters:

Name Type Default Description
side FloatVal 1.0 Square with side side, centered on its position.
**props Unpack[RectKeywords] variadic Keyword arguments (RectKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal, radius: FloatVal.

Props inherited from k.Rect: fill, fill_opacity, stroke, stroke_width, dash, w, h, radius.

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def square(s: k.Scene):
    sq = k.Square(2, fill=k.YELLOW, fill_opacity=0.4).place(at="center")
    s.play(k.draw(sq))
    s.play(sq.to(rotate=90))

See also: k.Rect.

Members:

  • on: The square built on a polygon edge, outside (or inside) the polygon.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Square.on (staticmethod)

k.Square.on(
    side: Side,
    outward: bool = True,
    **props: Unpack[UnplacedStyleKeywords],
) -> Polygon

The square built on a polygon edge, outside (or inside) the polygon.

Parameters:

Name Type Default Description
side Side required
outward bool True
**props Unpack[UnplacedStyleKeywords] variadic Keyword arguments (UnplacedStyleKeywords): name: str | None, key: str | None, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

k.Polygon (class)

k.Polygon(*points: VecLike | list[VecLike], **props: Unpack[StyleKeywords])

Polygon from its vertices (k.Polygon((0, 0), (2, 0), (1, 1))), centered on its bounding box. k.Polygon.regular(n, r=) creates the regular n-sided polygon.

Parameters:

Name Type Default Description
*points VecLike | list[VecLike] variadic
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
points points [] pointwise

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def hexagon(s: k.Scene):
    hex_ = k.Polygon.regular(6, r=1.5).place(at="center")
    s.play(k.draw(hex_))
    s.play(hex_.to(rotate=30))

See also: k.Triangle, k.Path.

Members:

  • regular: Regular polygon with n sides (a signal works: the shape follows it) and circumradius r, a vertex on top.
  • sides: Edges in world coordinates, at the cursor.
  • vertices: Vertices in the polygon's own coordinates, at the cursor.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Polygon.regular (classmethod)

k.Polygon.regular(
    n: FloatVal,
    r: FloatVal = 1.0,
    **props: Unpack[StyleKeywords],
) -> RegularPolygon

Regular polygon with n sides (a signal works: the shape follows it) and circumradius r, a vertex on top.

Parameters:

Name Type Default Description
n FloatVal required Regular polygon with n sides (a signal works: the shape follows it) and circumradius r, a vertex on top.
r FloatVal 1.0 Regular polygon with n sides (a signal works: the shape follows it) and circumradius r, a vertex on top.
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

k.Polygon.sides (property)

polygon.sides: list[Side]  # read-only

Edges in world coordinates, at the cursor.

k.Polygon.vertices (property)

polygon.vertices: list[tuple[float, float]]  # read-only

Vertices in the polygon's own coordinates, at the cursor.

k.Triangle (class)

k.Triangle(*points: VecLike | list[VecLike], **props: Unpack[StyleKeywords])

Triangle from its three vertices (no arguments: equilateral with radius 1). k.Triangle.right(a, b, scale=) creates the right triangle with legs a and b.

Parameters:

Name Type Default Description
*points VecLike | list[VecLike] variadic
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props inherited from k.Polygon: fill, fill_opacity, stroke, stroke_width, dash, points.

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def triangle(s: k.Scene):
    tri = k.Triangle.right(3, 4, scale=0.6).place(at="center")
    s.play(k.draw(tri))
    s.wait(0.5)

See also: k.Polygon.

Members:

  • right: Right triangle with legs a (horizontal) and b (vertical).

Inherited from k.Polygon: regular, sides, vertices. Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Triangle.right (classmethod)

k.Triangle.right(
    a: float,
    b: float,
    scale: float = 1.0,
    **props: Unpack[UnscaledStyleKeywords],
) -> Triangle

Right triangle with legs a (horizontal) and b (vertical).

Parameters:

Name Type Default Description
a float required Right triangle with legs a (horizontal) and b (vertical).
b float required Right triangle with legs a (horizontal) and b (vertical).
scale float 1.0
**props Unpack[UnscaledStyleKeywords] variadic Keyword arguments (UnscaledStyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

k.Line (class)

k.Line(
    start: VecVal | None = None,
    end: VecVal | None = None,
    *,
    length: float | None = None,
    **props: Unpack[StyleKeywords],
)

Segment from start to end (local coordinates), or centered with length=. The endpoints accept signals, which makes the line follow other objects.

Parameters:

Name Type Default Description
start VecVal | None None Segment from start to end (local coordinates), or centered with length=.
end VecVal | None None Segment from start to end (local coordinates), or centered with length=.
length float | None None Segment from start to end (local coordinates), or centered with length=.
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
start vec2 (-1.0, 0.0) linear
end vec2 (1.0, 0.0) linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def line(s: k.Scene):
    floor = k.Line(length=10).place(at="bottom", margin=1.5)
    ray = k.Line(start=(0, 0), end=(2, 1), stroke=k.BLUE)
    s.play(k.draw(floor), k.draw(ray))
    s.wait(0.5)

See also: k.Arrow, k.Path.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Arrow (class)

k.Arrow(
    start: VecVal | None = None,
    end: VecVal | None = None,
    **props: Unpack[ArrowKeywords],
)

Arrow from start to end with a tip of size tip. The endpoints accept signals.

Parameters:

Name Type Default Description
start VecVal | None None Arrow from start to end with a tip of size tip.
end VecVal | None None Arrow from start to end with a tip of size tip.
**props Unpack[ArrowKeywords] variadic Keyword arguments (ArrowKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal, tip: FloatVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 1.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
start vec2 (-1.0, 0.0) linear
end vec2 (1.0, 0.0) linear
tip float 0.25 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def arrow(s: k.Scene):
    a = k.Text("A").place(at="left", margin=3)
    b = k.Text("B").place(at="right", margin=3)
    link = k.Arrow(start=(-3.5, 0), end=(3.5, 0), stroke=k.YELLOW, fill=k.YELLOW)
    s.add(a, b)
    s.play(k.draw(link))

See also: k.Line.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Arc (class)

k.Arc(
    r: FloatVal = 1.0,
    start_angle: FloatVal = 0.0,
    angle: FloatVal = 90.0,
    **props: Unpack[StyleKeywords],
)

Circular arc of radius r, starting at start_angle and sweeping angle degrees (counterclockwise).

Parameters:

Name Type Default Description
r FloatVal 1.0 Circular arc of radius r, starting at start_angle and sweeping angle degrees (counterclockwise).
start_angle FloatVal 0.0 Circular arc of radius r, starting at start_angle and sweeping angle degrees (counterclockwise).
angle FloatVal 90.0 Circular arc of radius r, starting at start_angle and sweeping angle degrees (counterclockwise).
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
r float 1.0 linear
start_angle float 0.0 linear
angle float 90.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def arc(s: k.Scene):
    sweep = k.Arc(r=1.5, start_angle=0, angle=270, stroke=k.ORANGE).place(at="center")
    s.play(k.draw(sweep))
    s.play(sweep.to(angle=360))

See also: k.Circle.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Path (class)

k.Path(
    d: str | Sequence[VecLike] = "",
    *,
    closed: bool = False,
    **props: Unpack[StyleKeywords],
)

Path from SVG commands (d="M 0 0 L 1 1") or a polyline from a list of points; closed=True closes the outline.

Parameters:

Name Type Default Description
d str | Sequence[VecLike] "" Path from SVG commands (d="M 0 0 L 1 1") or a polyline from a list of points; closed=True closes the outline.
closed bool False Path from SVG commands (d="M 0 0 L 1 1") or a polyline from a list of points; closed=True closes the outline.
**props Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
fill color theme.fg linear
fill_opacity float 0.0 linear
stroke color theme.fg linear
stroke_width float theme.stroke_width linear
dash floats () step_end
d str "" step_end
closed bool False step_end

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def path(s: k.Scene):
    zigzag = k.Path([(-3, 0), (-1, 1), (1, -1), (3, 0)], stroke=k.TEAL).place(at="center")
    s.play(k.draw(zigzag), duration=1.5)
    s.wait(0.5)

See also: k.Polygon, k.follow.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.union (function)

k.union(a: Node, b: Node, **style: Unpack[StyleKeywords]) -> Path

Boolean operations between shapes: k.union(a, b), k.intersect(a, b) and k.subtract(a, b) return a new k.Path computed from the outlines at the cursor (with the style of a, unless another one is passed).

Parameters:

Name Type Default Description
a Node required Boolean operations between shapes: k.union(a, b), k.intersect(a, b) and k.subtract(a, b) return a new k.Path computed from the outlines at the cursor (with the style of a, unless another one is passed).
b Node required Shape covering a or b (style of a unless given).
**style Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

Example:

@k.scene
def moon(s: k.Scene):
    disk = k.Circle(1.5, fill=k.YELLOW, fill_opacity=1, stroke_width=0)
    shadow = k.Circle(1.3, x=0.8)
    crescent = k.subtract(disk, shadow)
    s.play(k.draw(crescent))

See also: k.Path, k.Circle.

k.intersect (function)

k.intersect(a: Node, b: Node, **style: Unpack[StyleKeywords]) -> Path

Shape covering both a and b.

Documented together with k.union.

Parameters:

Name Type Default Description
a Node required Shape covering both a and b.
b Node required Shape covering both a and b.
**style Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

k.subtract (function)

k.subtract(a: Node, b: Node, **style: Unpack[StyleKeywords]) -> Path

a with b cut out.

Documented together with k.union.

Parameters:

Name Type Default Description
a Node required a with b cut out.
b Node required a with b cut out.
**style Unpack[StyleKeywords] variadic Keyword arguments (StyleKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, fill: ColorVal, fill_opacity: FloatVal, stroke: ColorVal, stroke_width: FloatVal, dash: FloatsVal, color: ColorVal.

k.Bar (class)

k.Bar(
    value: FloatVal = 0.0,
    *,
    label: bool = False,
    width: float = 0.6,
    unit: float = 0.4,
    color: ColorLike | None = None,
    **props: Unpack[TransformKeywords],
)

A value shown as a bar that grows from its base, with an optional label (label=True). bar.value is a signal: animating it changes the height and the label. Used in algorithms and charts.

Parameters:

Name Type Default Description
value FloatVal 0.0
label bool False A value shown as a bar that grows from its base, with an optional label (label=True).
width float 0.6
unit float 0.4
color ColorLike | None None
**props Unpack[TransformKeywords] variadic Keyword arguments (TransformKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
value float 0.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def bar(s: k.Scene):
    b = k.Bar(3, label=True).place(at="center")
    s.play(k.grow(b, from_="bottom"))
    s.play(b.to(value=7))
    s.wait(0.5)

See also: k.grow, k.Row, group.swap.

Inherited from k.Group: children, to, swap, insert, pop, fit. Inherited from k.Node: set, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Group (class)

k.Group(*children: ChildT | Sequence[ChildT], **props: Unpack[GroupKeywords])

Groups objects: transforms compose and opacity multiplies. An object has exactly one parent. Groups are iterable and indexable (g[0]), with indices at the cursor.

Parameters:

Name Type Default Description
*children ChildT | Sequence[ChildT] variadic
**props Unpack[GroupKeywords] variadic

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def group(s: k.Scene):
    sun = k.Circle(r=0.6, fill=k.YELLOW, fill_opacity=1)
    ray = k.Line(start=(0.8, 0), end=(1.4, 0), stroke=k.YELLOW)
    icon = k.Group(sun, ray).place(at="center")
    s.play(k.draw(icon))
    s.play(icon.to(scale=1.5, rotate=90))

See also: k.Row, k.Stack, k.Component.

Members:

  • children: Children at the cursor, in order (reflects reorders already scheduled).
  • to: Animated change of state; children= reorders, inserts or removes children with an animated reflow.
  • swap: Named transition: swaps the places of two children and the container animates the reflow.
  • insert: Named transition: inserts a child at position i; it enters together with the reflow.
  • pop: Named transition: removes the child at position i (default: the last one); it exits together with the reflow.
  • fit: Scales the group once, at the cursor, until it fits an area (usually s.frame.safe, the frame's safe area), with an optional margin=.

Inherited from k.Node: set, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Group.children (property)

group.children: list[ChildT]  # read-only

Children at the cursor, in order (reflects reorders already scheduled).

k.Group.to (method)

group.to(
    *,
    duration: float | None = None,
    ease: EaseLike | None = None,
    delay: float = 0.0,
    blend: Blend = "replace",
    place: PlaceKeywords | Mapping[str, object] | None = None,
    children: Sequence[Node] | None = None,
    **props: Unpack[PropChanges],
) -> Animation

Animated change of state; children= reorders, inserts or removes children with an animated reflow.

Parameters:

Name Type Default Description
duration float | None None
ease EaseLike | None None
delay float 0.0
blend Blend "replace"
place PlaceKeywords | Mapping[str, object] | None None
children Sequence[Node] | None None Animated change of state; children= reorders, inserts or removes children with an animated reflow.
**props Unpack[PropChanges] variadic

k.Group.swap (method)

group.swap(i: int, j: int, **kw: Unpack[ReorderTiming]) -> Animation

Named transition: swaps the places of two children and the container animates the reflow. Equivalent to group.to(children=[...]) with i and j swapped.

Parameters:

Name Type Default Description
i int required Equivalent to group.to(children=[...]) with i and j swapped.
j int required Equivalent to group.to(children=[...]) with i and j swapped.
**kw Unpack[ReorderTiming] variadic Keyword arguments (ReorderTiming): duration: float | None, ease: EaseLike | None.

Example:

@k.scene
def swap(s: k.Scene):
    bars = [k.Bar(v, label=True) for v in [4, 1, 3]]
    row = k.Row(*bars, gap=0.3, align="bottom").place(at="center")
    s.add(row)
    s.play(row.swap(0, 1), duration=0.6)
    s.play(row.swap(1, 2), duration=0.6)

See also: group.insert, group.pop, k.Row.

k.Group.insert (method)

group.insert(i: int, obj: Node, **kw: Unpack[ReorderTiming]) -> Animation

Named transition: inserts a child at position i; it enters together with the reflow. Equivalent to group.to(children=[...]).

Parameters:

Name Type Default Description
i int required Named transition: inserts a child at position i; it enters together with the reflow.
obj Node required
**kw Unpack[ReorderTiming] variadic Keyword arguments (ReorderTiming): duration: float | None, ease: EaseLike | None.

Example:

@k.scene
def insert(s: k.Scene):
    row = k.Row(k.Square(0.8), k.Square(0.8), gap=0.4).place(at="center")
    s.add(row)
    s.play(row.insert(1, k.Circle(r=0.4, fill=k.RED, fill_opacity=1)))
    s.wait(0.5)

See also: group.pop, group.swap.

k.Group.pop (method)

group.pop(i: int = -1, **kw: Unpack[ReorderTiming]) -> Animation

Named transition: removes the child at position i (default: the last one); it exits together with the reflow. Equivalent to group.to(children=[...]).

Parameters:

Name Type Default Description
i int -1 Named transition: removes the child at position i (default: the last one); it exits together with the reflow.
**kw Unpack[ReorderTiming] variadic Keyword arguments (ReorderTiming): duration: float | None, ease: EaseLike | None.

Example:

@k.scene
def remove(s: k.Scene):
    row = k.Row(*[k.Square(0.8) for _ in range(4)], gap=0.4).place(at="center")
    s.add(row)
    s.play(row.pop(0))
    s.wait(0.5)

See also: group.insert, group.swap.

k.Group.fit (method)

group.fit(area: FrameRect, margin: float = 0.0) -> Group

Scales the group once, at the cursor, until it fits an area (usually s.frame.safe, the frame's safe area), with an optional margin=.

Parameters:

Name Type Default Description
area FrameRect required Scale (once, at the cursor) so the group fits inside area (e.g.
margin float 0.0 Scales the group once, at the cursor, until it fits an area (usually s.frame.safe, the frame's safe area), with an optional margin=.

Example:

@k.scene
def fit(s: k.Scene):
    cards = [k.RoundedRect(w=3, h=2) for _ in range(12)]
    grid = k.Grid(*cards, cols=4, gap=0.4).place(at="center").fit(s.frame.safe)
    s.play(k.draw(grid))
    s.wait(0.5)

See also: k.Grid.

k.Image (class)

k.Image(
    path: str | os.PathLike[str],
    width: float | None = None,
    height: float | None = None,
    **props: Unpack[TransformKeywords],
)

Raster image (PNG or JPEG) drawn by the renderer, centered on its position. Without a size it is 3 units tall; with width= or height= the other side follows the file's aspect ratio (props w and h, animatable). Relative paths start from the folder of the scene file. Accepts scale, rotate and opacity; morphs and layout treat it as its rectangle, and the exported SVG embeds the file.

Parameters:

Name Type Default Description
path str | os.PathLike[str] required
width float | None None Without a size it is 3 units tall; with width= or height= the other side follows the file's aspect ratio (props w and h, animatable).
height float | None None Without a size it is 3 units tall; with width= or height= the other side follows the file's aspect ratio (props w and h, animatable).
**props Unpack[TransformKeywords] variadic Keyword arguments (TransformKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
src str "" step_end
w float 1.0 linear
h float 1.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def image(s: k.Scene):
    photo = k.Image("photo.png", height=4)
    s.play(k.fade_in(photo), photo.to(scale=0.8, rotate=-5))

See also: k.SVG, k.morph.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.SVG (class)

k.SVG(
    source: str | os.PathLike[str],
    height: float = 3.0,
    **props: Unpack[TransformKeywords],
)

Imports an SVG illustration (a file or inline markup): each shape becomes a k.Path with the SVG's fill, stroke and stroke width, and each <g> becomes a k.Group. The drawing is scaled to be height units tall and centered on the position. Elements with an id are addressable: svg["#motor"] returns that object, which animates like any other; svg.ids lists the ids.

Parameters:

Name Type Default Description
source str | os.PathLike[str] required
height float 3.0 The drawing is scaled to be height units tall and centered on the position.
**props Unpack[TransformKeywords] variadic Keyword arguments (TransformKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal.

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def illustration(s: k.Scene):
    machine = k.SVG("motor.svg", height=3)
    s.play(k.draw(machine))
    s.play(machine["#polia"].to(fill=k.RED), k.indicate(machine["#motor"]))

See also: k.Path, k.Image, k.Group.

Members:

  • ids: Ids of the addressable elements, in document order.

Inherited from k.Group: children, to, swap, insert, pop, fit. Inherited from k.Node: set, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.SVG.ids (property)

svg.ids: list[str]  # read-only

Ids of the addressable elements, in document order.

k.Brace (class)

k.Brace(
    target: Node,
    direction: BraceDirection = "down",
    label: str | Node | None = None,
    gap: FloatVal = 0.1,
    *,
    depth: FloatVal = 0.25,
    color: ColorLike | None = None,
    label_gap: float = 0.12,
    **props: Unpack[TransformKeywords],
)

Curly brace (}) along one side of an object's box: direction= "down", "up", "left" or "right", gap units away from it, with the tip pointing outward. It is recomputed every frame from the target's layout, so it follows the object when it moves or changes size. label= (text or an object) sits beyond the tip, as brace.label; the brace itself is brace.shape.

Parameters:

Name Type Default Description
target Node required
direction BraceDirection "down" Curly brace (}) along one side of an object's box: direction= "down", "up", "left" or "right", gap units away from it, with the tip pointing outward.
label str | Node | None None label= (text or an object) sits beyond the tip, as brace.label; the brace itself is brace.shape.
gap FloatVal 0.1 Curly brace (}) along one side of an object's box: direction= "down", "up", "left" or "right", gap units away from it, with the tip pointing outward.
depth FloatVal 0.25
color ColorLike | None None
label_gap float 0.12
**props Unpack[TransformKeywords] variadic Keyword arguments (TransformKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal.

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def brace(s: k.Scene):
    bar = k.Rect(w=3, h=0.6, fill=k.BLUE, fill_opacity=0.8)
    s.play(k.draw(bar), k.draw(k.Brace(bar, "down", label="width")))
    s.play(bar.to(w=6))

See also: k.Rect, obj.place.

Inherited from k.Group: children, to, swap, insert, pop, fit. Inherited from k.Node: set, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.Points (class)

k.Points(
    xy: PointsInput | None = None,
    radius: PerPointFloat = 0.02,
    color: PerPointColor | None = None,
    *,
    x: FloatColumn | None = None,
    y: FloatColumn | None = None,
    **props: Unpack[UnplacedKeywords],
)

Thousands of points in a single object, batch-drawn in the core. xy is a numpy array (n, 2), a list of (x, y) or columns (x=, y=). radius and color accept one value, one per point, or a function of the symbolic point p (p.x, p.y, p.index, p.t), traced and vectorized in Rust. Never create thousands of k.Dot in a loop (W0901).

Parameters:

Name Type Default Description
xy PointsInput | None None xy is a numpy array (n, 2), a list of (x, y) or columns (x=, y=).
radius PerPointFloat 0.02 radius and color accept one value, one per point, or a function of the symbolic point p (p.x, p.y, p.index, p.t), traced and vectorized in Rust.
color PerPointColor | None None radius and color accept one value, one per point, or a function of the symbolic point p (p.x, p.y, p.index, p.t), traced and vectorized in Rust.
x FloatColumn | None None xy is a numpy array (n, 2), a list of (x, y) or columns (x=, y=).
y FloatColumn | None None xy is a numpy array (n, 2), a list of (x, y) or columns (x=, y=).
**props Unpack[UnplacedKeywords] variadic Keyword arguments (UnplacedKeywords): name: str | None, key: str | None, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
xy points [] pointwise
radius float 0.02 linear
color color theme.accent linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

import numpy as np
import kinemo as k

@k.scene
def cloud(s: k.Scene):
    xy = np.random.default_rng(1).uniform((-6, -3), (6, 3), size=(5000, 2))
    pts = k.Points(xy, radius=0.03, color=lambda t, p: k.mix(k.BLUE, k.RED, (p.x + 6) / 12))
    s.play(k.draw(pts), duration=2)

See also: k.VectorField, k.StreamLines, k.python.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.VectorField (class)

k.VectorField(
    fn: FieldFunction,
    density: FloatVal = 30,
    *,
    length: FloatVal = 0.8,
    x_range: VecVal | None = None,
    y_range: VecVal | None = None,
    color: PerPointColor | None = None,
    **props: Unpack[FieldKeywords],
)

Arrows of a field fn(x, y) -> (vx, vy) on a grid with density columns across the width of the region (x_range, y_range). Size and color (theme accent → secondary) follow the magnitude; length scales the arrows. fn is traced once and may use k.time.

Parameters:

Name Type Default Description
fn FieldFunction required fn is traced once and may use k.time.
density FloatVal 30 Arrows of a field fn(x, y) -> (vx, vy) on a grid with density columns across the width of the region (x_range, y_range).
length FloatVal 0.8 Size and color (theme accent → secondary) follow the magnitude; length scales the arrows.
x_range VecVal | None None Arrows of a field fn(x, y) -> (vx, vy) on a grid with density columns across the width of the region (x_range, y_range).
y_range VecVal | None None Arrows of a field fn(x, y) -> (vx, vy) on a grid with density columns across the width of the region (x_range, y_range).
color PerPointColor | None None Arrow length is length × cell × |v| / max|v|; color mixes color_low → color_high (theme accent → secondary) by the same magnitude, unless color is given (a value or a function of the point).
**props Unpack[FieldKeywords] variadic Keyword arguments (FieldKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, stroke_width: FloatVal, color_low: ColorVal, color_high: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
field vec2 (0.0, 0.0) linear
density float 30.0 linear
length float 0.8 linear
x_range vec2 None linear
y_range vec2 None linear
color color None linear
color_low color theme.accent linear
color_high color theme._secondary linear
stroke_width float 2.5 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def rotation(s: k.Scene):
    field = k.VectorField(lambda x, y: (-y, x), density=24)
    s.play(k.draw(field), duration=2)

See also: k.StreamLines, k.Points.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.

k.StreamLines (class)

k.StreamLines(
    field: FieldFunction,
    seeds: int | PointsInput = 200,
    *,
    step: FloatVal = 0.05,
    steps: FloatVal = 60,
    progress: FloatVal = 1.0,
    tail: FloatVal = 1.0,
    fade: FloatVal = 0.0,
    x_range: VecVal | None = None,
    y_range: VecVal | None = None,
    color: PerPointColor | None = None,
    **props: Unpack[FieldKeywords],
)

Streamlines of a field (a k.VectorField or a function), integrated with RK4 in the core from seeds (a count or points). progress draws the lines over time; tail is the visible fraction behind the head and fade the opacity of the tail.

Parameters:

Name Type Default Description
field FieldFunction required Lines that follow field (a VectorField, or a function like VectorField's). lines = k.StreamLines(field, seeds=200) s.play(lines.to(progress=1), duration=3) seeds: a count (deterministic Halton points over the region) or the starting points ((n, 2) array or list).
seeds int | PointsInput 200 Streamlines of a field (a k.VectorField or a function), integrated with RK4 in the core from seeds (a count or points).
step FloatVal 0.05 Lines advance step units per RK4 step along the field direction, at most steps steps, and stop at the region border or where the field vanishes.
steps FloatVal 60 Lines advance step units per RK4 step along the field direction, at most steps steps, and stop at the region border or where the field vanishes.
progress FloatVal 1.0 progress draws the lines over time; tail is the visible fraction behind the head and fade the opacity of the tail.
tail FloatVal 1.0 progress draws the lines over time; tail is the visible fraction behind the head and fade the opacity of the tail.
fade FloatVal 0.0 progress draws the lines over time; tail is the visible fraction behind the head and fade the opacity of the tail.
x_range VecVal | None None
y_range VecVal | None None
color PerPointColor | None None Colors mix color_low → color_high by mean magnitude, unless color is given.
**props Unpack[FieldKeywords] variadic Keyword arguments (FieldKeywords): name: str | None, key: str | None, x: FloatVal, y: FloatVal, position: VecVal, rotate: FloatVal, anchor: VecVal, z: FloatVal, scale: FloatVal, scale_x: FloatVal, scale_y: FloatVal, opacity: FloatVal, visible: BoolVal, stroke_width: FloatVal, color_low: ColorVal, color_high: ColorVal.

Props (animatable with .to(), settable with .set() or in the constructor):

Prop Kind Default Interpolation
field vec2 (0.0, 0.0) linear
seeds points [] step_end
seed_count float 200.0 step_end
step float 0.05 linear
steps float 60.0 step_end
progress float 1.0 linear
tail float 1.0 linear
fade float 0.0 linear
x_range vec2 None linear
y_range vec2 None linear
color color None linear
color_low color theme.accent linear
color_high color theme._secondary linear
stroke_width float 2.0 linear

Props inherited from k.Node: x, y, rotate, scale, scale_x, scale_y, anchor, opacity, z, visible.

Example:

@k.scene
def stream(s: k.Scene):
    field = k.VectorField(lambda x, y: (-y, x), density=24)
    lines = k.StreamLines(field, seeds=150, progress=0.0, tail=0.5)
    s.add(field)
    s.play(k.fade_in(lines), lines.to(progress=1), duration=3)

See also: k.VectorField.

Inherited from k.Node: set, to, unbind, edge, age, entered, exited, copy, place, to_place, unpin.