Class Command
Represents a graphics primitive, for example a circle or a curve.
Commands allow reading and writing properties of primitives after they have been created. Only certain properties are available for each type of primitive. For example, a circle knows cx, cy and r.
Tables
Command.w | width |
Command.h | height |
Command.cx | x coordinate of center |
Command.cy | y coordinate of center |
Command.rx | x radius |
Command.ry | y radius |
Command.r | radius |
Command.x0 | x coordinate of curve point P0 |
Command.y0 | y coordinate of curve point P0 |
Command.cp1x | x coordinate of first control point P1 |
Command.cp1y | y coordinate of first control point P1 |
Command.cp2x | x coordinate of second control point P2 |
Command.cp2y | y coordinate of second control point P2 |
Command.x | x coordinate of curve point P3 |
Command.y | y coordinate of curve point P3 |
Tables
- Command.w
-
width
Usage:
local graphics = tove.newGraphics() graphics:setFillColor(1, 1, 1) local rect = graphics:drawRect(0, 0, 10, 10) graphics:fill() rect.w = 20 -- change/animate width
- Command.h
- height
- Command.cx
-
x coordinate of center
Usage:
local circle = graphics:drawCircle(0, 0, 10) circle.cx = 5 -- change/animate x position
- Command.cy
- y coordinate of center
- Command.rx
-
x radius
Usage:
local circle = graphics:drawCircle(0, 0, 10) circle.rx = 5 -- change/animate x radius
- Command.ry
- y radius
- Command.r
-
radius
Usage:
local circle = graphics:drawCircle(0, 0, 10) circle.r = 5 -- change/animate radius
- Command.x0
- x coordinate of curve point P0
- Command.y0
- y coordinate of curve point P0
- Command.cp1x
- x coordinate of first control point P1
- Command.cp1y
- y coordinate of first control point P1
- Command.cp2x
- x coordinate of second control point P2
- Command.cp2y
- y coordinate of second control point P2
- Command.x
- x coordinate of curve point P3
- Command.y
- y coordinate of curve point P3