Shapes¶
keyed.shapes
¶
Drawable primative shapes, like rectangles and circles.
Shape
¶
Bases: Base
Base class for drawable shapes that can be added to a scene.
Subclasses should provide specific drawing behavior.
Attributes:
Name | Type | Description |
---|---|---|
scene |
Scene
|
The scene to which the shape belongs. |
ctx |
ContextT
|
The Cairo context used for drawing the shape. |
color |
HasValue[Color]
|
The color of the shape's stroke. |
fill_color |
HasValue[Color]
|
The color used to fill the shape. |
alpha |
ReactiveValue[float]
|
The opacity of the shape, where 0 is transparent and 1 is opaque. |
dash |
tuple[Sequence[float], float] | None
|
The dash pattern for the shape's outline. A tuple where the first element is a sequence of dash lengths and the second element is the offset. None indicates a solid line. |
operator |
Operator
|
The compositing operator used when rendering the shape. |
draw_fill |
bool
|
Whether the shape should be filled. |
draw_stroke |
bool
|
Whether the shape's outline should be drawn. |
line_width |
ReactiveValue[float]
|
The width of the outline stroke. |
line_cap |
LineCap
|
The style of the line ends among cairo.LINE_CAP_BUTT, cairo.LINE_CAP_ROUND, or cairo.LINE_CAP_SQUARE. |
line_join |
LineJoin
|
Specifies how the joins between line segments are drawn among cairo.LINE_JOIN_MITER, cairo.LINE_JOIN_ROUND, or cairo.LINE_JOIN_BEVEL. |
Source code in src/keyed/shapes.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
draw
¶
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
Rectangle
¶
Bases: Shape
A rectangle with optionally rounded corners.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene
|
Scene
|
The scene to which the rectangle belongs. |
required |
width
|
HasValue[float]
|
The width of the rectangle. |
10
|
height
|
HasValue[float]
|
The height of the rectangle. |
10
|
x
|
HasValue[float] | None
|
The x-coordinate of the rectangle's position. Default is to center in the scene. |
None
|
y
|
HasValue[float] | None
|
The y-coordinate of the rectangle's position. Default is to center in the scene. |
None
|
radius
|
HasValue[float]
|
The radius of the corners of the rectangle. |
0
|
color
|
tuple[float, float, float] | HasValue[Color]
|
The color of the rectangle's border. |
(1, 1, 1)
|
fill_color
|
tuple[float, float, float] | HasValue[Color]
|
The fill color of the rectangle. |
(1, 1, 1)
|
alpha
|
HasValue[float]
|
The opacity level of the rectangle. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the outline of the rectangle. |
None
|
operator
|
Operator
|
The compositing operator to use for drawing. |
OPERATOR_OVER
|
draw_fill
|
bool
|
Whether to fill the rectangle. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the rectangle. |
True
|
line_width
|
HasValue[float]
|
The width of the line used to stroke the rectangle. |
2
|
rotation
|
HasValue[float]
|
The rotation angle of the rectangle, in radians. |
0
|
round_tl
|
bool
|
Whether to round the top-left corner. |
True
|
round_tr
|
bool
|
Whether to round the top-right corner. |
True
|
round_br
|
bool
|
Whether to round the bottom-right corner. |
True
|
round_bl
|
bool
|
Whether to round the bottom-left corner. |
True
|
Source code in src/keyed/shapes.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
|
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
draw
¶
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
Circle
¶
Bases: Shape
A circle.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene
|
Scene
|
The scene to which the circle belongs. |
required |
x
|
HasValue[float] | None
|
The x-coordinate of the center of the circle. Default is to center in the scene. |
None
|
y
|
HasValue[float] | None
|
The y-coordinate of the center of the circle. Default is to center in the scene. |
None
|
radius
|
HasValue[float]
|
The radius of the circle. |
1
|
color
|
tuple[float, float, float] | HasValue[Color]
|
The color of the circle's outline. |
(1, 1, 1)
|
fill_color
|
tuple[float, float, float] | HasValue[Color]
|
The fill color of the circle. |
(1, 1, 1)
|
alpha
|
float
|
The opacity level of the circle. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the outline of the circle. |
None
|
operator
|
Operator
|
The compositing operator to use for drawing. |
OPERATOR_OVER
|
draw_fill
|
bool
|
Whether to fill the circle. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the circle. |
True
|
line_width
|
float
|
The width of the line used to stroke the circle. |
2
|
Source code in src/keyed/shapes.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
|
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
draw
¶
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
Background
¶
Bases: Rectangle
A rectangle that fills the scene.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene
|
Scene
|
The scene to which the rectangle belongs. |
required |
color
|
tuple[float, float, float] | HasValue[Color]
|
The color of the rectangle's border. |
(1, 1, 1)
|
fill_color
|
tuple[float, float, float] | HasValue[Color]
|
The fill color of the rectangle. |
(1, 1, 1)
|
alpha
|
HasValue[float]
|
The opacity level of the rectangle. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the outline of the rectangle. |
None
|
operator
|
Operator
|
The compositing operator to use for drawing. |
OPERATOR_OVER
|
draw_fill
|
bool
|
Whether to fill the rectangle. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the rectangle. |
True
|
line_width
|
HasValue[float]
|
The width of the line used to stroke the rectangle. |
2
|
Source code in src/keyed/shapes.py
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
draw
¶
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
keyed.curve
¶
Draw lines and curves.
Curve
¶
Bases: Shape
Draw a curve through the a collection of object's centroids centroids.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene
|
Scene
|
The scene to which the curve belongs. |
required |
objects
|
Sequence[Base]
|
The objects through which the curve will pass. |
required |
color
|
tuple[float, float, float] | Color
|
The color of the curve in RGB format. |
(1, 1, 1)
|
fill_color
|
tuple[float, float, float] | Color
|
The color of the curve's fill in RGB format. |
(1, 1, 1)
|
alpha
|
float
|
The transparency of the curve. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
Dash pattern for the line, specified as a sequence of lengths and gaps. |
None
|
operator
|
Operator
|
The compositing operator to use for drawing. |
OPERATOR_OVER
|
line_width
|
float
|
The width of the curve line. |
1
|
tension
|
float
|
The tension factor used in calculating control points for the curve. |
1
|
Raises:
Type | Description |
---|---|
ValueError
|
If fewer than 2 objects are provided. |
Source code in src/keyed/curve.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
from_points
classmethod
¶
from_points(scene, points, color=(1, 1, 1), fill_color=(1, 1, 1), alpha=1, dash=None, operator=OPERATOR_OVER, line_width=1, tension=1, buffer=30, draw_fill=True, draw_stroke=True)
Create a Curve object directly from a sequence of points.
Source code in src/keyed/curve.py
write_on
¶
write_on(value, start, end, easing=cubic_in_out)
Animate the line being drawn from start to end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/curve.py
write_off
¶
write_off(value, start, end, easing=cubic_in_out)
Animate the line being erased from end to start.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/curve.py
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
draw
¶
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
bezier_length
¶
Calculate the length of a cubic Bézier curve using numerical integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p0
|
Vector
|
First control point of the cubic Bézier curve. |
required |
p1
|
Vector
|
Second |
required |
p2
|
Vector
|
Third |
required |
p3
|
Vector
|
Fourth |
required |
Returns:
Type | Description |
---|---|
Vector
|
The total length of the cubic Bézier curve. |
Source code in src/keyed/curve.py
keyed.line
¶
Line
¶
Bases: Base
Draw a line between two points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x0
|
HasValue[float] | None
|
x coordinate of first point. |
None
|
y0
|
HasValue[float] | None
|
y coordinate of first point. |
None
|
x1
|
HasValue[float] | None
|
x coordinate of second point. |
None
|
y1
|
HasValue[float] | None
|
y coordinate of second point. |
None
|
color
|
HasValue[Color] | tuple[float, float, float]
|
Line color. |
(1, 1, 1)
|
alpha
|
HasValue[float]
|
Transparency. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
Dash specification. |
None
|
operator
|
Operator
|
Blend mode. |
OPERATOR_OVER
|
line_width
|
HasValue[float]
|
width of line. |
1
|
Source code in src/keyed/line.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
draw
¶
Draw the shape within its styled context, applying transformations.
Source code in src/keyed/line.py
write_on
¶
write_on(value, start, end, easing=cubic_in_out)
Animate the line being drawn from start to end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/line.py
write_off
¶
write_off(value, start, end, easing=cubic_in_out)
Animate the line being erased from end to start.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/line.py
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
BezierCurve
¶
Bases: Base
Source code in src/keyed/line.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
draw
¶
Draw the shape within its styled context, applying transformations.
Source code in src/keyed/line.py
write_on
¶
write_on(value, start, end, easing=cubic_in_out)
Animate the line being drawn from start to end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/line.py
write_off
¶
write_off(value, start, end, easing=cubic_in_out)
Animate the line being erased from end to start.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to animate to |
required |
start
|
int
|
Frame to start the animation |
required |
end
|
int
|
Frame to end the animation |
required |
easing
|
EasingFunctionT
|
Easing function to use |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/line.py
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
bezier_point
¶
Calculate a point on a cubic Bezier curve at parameter t.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
The parameter between 0 and 1. |
required |
x0
|
float
|
The x coordinate of the first control point of the cubic Bézier curve. |
required |
y0
|
float
|
The y coordinate of the first control point of the cubic Bézier curve. |
required |
x1
|
float
|
Second x |
required |
y1
|
float
|
Second y |
required |
x2
|
float
|
Third x |
required |
y2
|
float
|
Third y |
required |
x3
|
float
|
Fourth x |
required |
y3
|
float
|
Fourth y |
required |
Returns: tuple: The point on the curve at parameter t.
Source code in src/keyed/line.py
approximate_bezier_as_linestring
¶
Approximate a cubic Bezier curve as a Shapely LineString.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x0
|
float
|
The x coordinate of the first control point of the cubic Bézier curve. |
required |
y0
|
float
|
The y coordinate of the first control point of the cubic Bézier curve. |
required |
x1
|
float
|
Second x |
required |
y1
|
float
|
Second y |
required |
x2
|
float
|
Third x |
required |
y2
|
float
|
Third y |
required |
x3
|
float
|
Fourth x |
required |
y3
|
float
|
Fourth y |
required |
num_points
|
int
|
Number of points to sample along the curve. |
20
|
Returns:
Type | Description |
---|---|
LineString
|
shapely.geometry.LineString: The approximated curve as a LineString. |
Source code in src/keyed/line.py
keyed.geometry
¶
Object that draws directly from a shapely geometry.
Geometry
¶
Bases: Shape
A shape defined by an arbitrary shapely geometry.
This class supports shapely geometries of type Polygon, MultiPolygon, LineString, Point, etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene
|
Scene
|
The scene to which the shape belongs. |
required |
geometry
|
HasValue[BaseGeometry]
|
The shapely geometry that defines the shape. |
required |
color
|
Union[tuple[float, float, float], Color]
|
The RGB color of the shape's outline. |
(1, 1, 1)
|
fill_color
|
Union[tuple[float, float, float], Color]
|
The RGB color of the shape's fill. |
(1, 1, 1)
|
alpha
|
float
|
The opacity of the shape. |
1
|
dash
|
Union[tuple[Sequence[float], float], None]
|
The dash pattern for the shape's outline. |
None
|
operator
|
Operator
|
The compositing operator to use for drawing. |
OPERATOR_OVER
|
line_cap
|
LineCap
|
The line cap style to use. |
LINE_CAP_ROUND
|
line_join
|
LineJoin
|
The line join style to use. |
LINE_JOIN_ROUND
|
line_width
|
float
|
The width of the shape's outline. |
1
|
buffer
|
float
|
The buffer distance to apply around the shape. |
0
|
draw_fill
|
bool
|
Whether to fill the shape. |
True
|
draw_stroke
|
bool
|
Whether to draw the outline. |
True
|
Source code in src/keyed/geometry.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
rotate
¶
rotate(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Rotate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to rotate by. |
required |
start
|
int
|
The frame to start rotating. |
ALWAYS
|
end
|
int
|
The frame to end rotating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
scale
¶
scale(amount, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Scale the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
|
HasValue[float]
|
Amount to scale by. |
required |
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
translate
¶
translate(x=0, y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out)
Translate the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float]
|
x offset. |
0
|
y
|
HasValue[float]
|
y offset. |
0
|
start
|
int
|
The frame to start translating. |
ALWAYS
|
end
|
int
|
The frame to end translating. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
Source code in src/keyed/transforms.py
move_to
¶
move_to(x=None, y=None, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Move object to absolute coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
HasValue[float] | None
|
Destination x coordinate |
None
|
y
|
HasValue[float] | None
|
Destination y coordinate |
None
|
start
|
int
|
Starting frame, by default ALWAYS |
ALWAYS
|
end
|
int
|
Ending frame, by default ALWAYS |
ALWAYS
|
easing
|
EasingFunctionT
|
Easing function, by default cubic_in_out |
cubic_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/transforms.py
align_to
¶
align_to(to, start=ALWAYS, lock=None, end=ALWAYS, from_=None, easing=cubic_in_out, direction=ORIGIN, center_on_zero=False)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
from_
|
ReactiveValue[GeometryT] | None
|
Use this object as self when doing the alignment. This is helpful for code animations. It is sometimes desirable to align, say, the top-left edge of one character in a TextSelection to the top-left of another character. |
None
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
ORIGIN
|
center_on_zero
|
bool
|
If true, align along the "0"-valued dimensions. Otherwise, only align to on non-zero directions. This is beneficial for, say, centering the object at the origin (which has a vector that consists of two zeros). |
False
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
lock_on
¶
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
start
|
int
|
When to start locking on. |
ALWAYS
|
end
|
int
|
When to end locking on. |
-ALWAYS
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
If true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
lock_on2
¶
lock_on2(target, reference=None, direction=ORIGIN, x=True, y=True)
Lock on to a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
Transformable
|
Object to lock onto |
required |
reference
|
ReactiveValue[GeometryT] | None
|
Measure from this object. This is useful for TextSelections, where you want to align to a particular character in the selection. |
None
|
x
|
bool
|
If true, lock on in the x dimension. |
True
|
y
|
bool
|
if true, lock on in the y dimension. |
True
|
Source code in src/keyed/transforms.py
shear
¶
shear(angle_x=0, angle_y=0, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None)
Shear the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle_x
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
angle_y
|
HasValue[float]
|
Angle (in degrees) to shear by along x direction. |
0
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
stretch
¶
stretch(scale_x=1, scale_y=1, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, center=None, direction=ORIGIN)
Stretch the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x
|
HasValue[float]
|
Amount to scale by in x direction. |
1
|
scale_y
|
HasValue[float]
|
Amount to scale by in y direction. |
1
|
start
|
int
|
The frame to start scaling. |
ALWAYS
|
end
|
int
|
The frame to end scaling. |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
center
|
ReactiveValue[GeometryT] | None
|
The object around which to rotate. |
None
|
direction
|
Direction
|
The relative critical point of the center. |
ORIGIN
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
next_to
¶
next_to(to, start=ALWAYS, end=ALWAYS, easing=cubic_in_out, offset=10.0, direction=LEFT)
Align the object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to
|
Transformable
|
The object to align to. |
required |
start
|
int
|
Start of animation (begin aligning to the object). |
ALWAYS
|
end
|
int
|
End of animation (finish aligning to the object at this frame, and then stay there). |
ALWAYS
|
easing
|
EasingFunctionT
|
The easing function to use. |
cubic_in_out
|
offset
|
HasValue[float]
|
Distance between objects (in pixels). |
10.0
|
direction
|
Direction
|
The critical point of to and from_to use for the alignment. |
LEFT
|
Returns:
Type | Description |
---|---|
Self
|
self |
Source code in src/keyed/transforms.py
draw
¶
emphasize
¶
emphasize(buffer=5, radius=0, fill_color=(1, 1, 1), color=(1, 1, 1), alpha=1, dash=None, line_width=2, draw_fill=True, draw_stroke=True, operator=OPERATOR_SCREEN)
Emphasize the object by drawing a rectangle around it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer
|
float
|
The buffer distance around the object's geometry for the emphasis. |
5
|
radius
|
float
|
The corner radius of the emphasized area. |
0
|
fill_color
|
tuple[float, float, float]
|
The fill color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
color
|
tuple[float, float, float]
|
The stroke color of the emphasis as an RGB tuple. |
(1, 1, 1)
|
alpha
|
float
|
The alpha transparency of the emphasis. |
1
|
dash
|
tuple[Sequence[float], float] | None
|
The dash pattern for the emphasis outline. Default is solid line. |
None
|
line_width
|
float
|
The line width of the emphasis outline. |
2
|
draw_fill
|
bool
|
Whether to draw the fill of the emphasis. |
True
|
draw_stroke
|
bool
|
Whether to draw the stroke of the emphasis. |
True
|
operator
|
Operator
|
The compositing operator to use for drawing the emphasis. |
OPERATOR_SCREEN
|
Returns:
Type | Description |
---|---|
Rectangle
|
A Rectangle object representing the emphasized area around the original object. |
Notes
This creates a Rectangle instance and sets up dynamic expressions to follow the geometry of the object as it changes through different frames, applying the specified emphasis effects. Emphasis should generally be applied after all animations on the original object have been added.
Source code in src/keyed/base.py
set
¶
set(property, value, frame=ALWAYS)
Set a property of the object at a specific frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property
|
str
|
The name of the property to set. |
required |
value
|
Any
|
The new value for the property. |
required |
frame
|
int
|
The frame at which the property value should be set. |
ALWAYS
|
Returns:
Type | Description |
---|---|
Self
|
Self |
See Also
Source code in src/keyed/base.py
set_literal
¶
center
¶
center(frame=ALWAYS)
fade
¶
fade(value, start, end, ease=linear_in_out)
Control the object's alpha parameter to fade it in or out.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
HasValue[float]
|
Value to set alpha to. |
required |
start
|
int
|
Frame to start changing alpha. |
required |
end
|
int
|
Frame to finish changing alpha. |
required |
ease
|
EasingFunctionT
|
Easing function |
linear_in_out
|
Returns:
Type | Description |
---|---|
Self
|
Self |
Source code in src/keyed/base.py
line_to
¶
Create a line connecting this object to another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Base
|
The target object to connect to |
required |
self_direction
|
Direction
|
Direction for the connection point on this object |
RIGHT
|
other_direction
|
Direction
|
Direction for the connection point on the target object |
LEFT
|
**line_kwargs
|
Any
|
Additional arguments to pass to the Line constructor. |
{}
|
Returns:
Type | Description |
---|---|
'Line'
|
The created Line object |
Source code in src/keyed/base.py
center
¶
Returns a geometry translated such that its centroid is at (0,0).