Scene
arabic_animations.core.scene.Scene
A scene represents a complete animation with one or more text objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
Width of the scene in pixels |
1920
|
height
|
int
|
Height of the scene in pixels |
1080
|
fps
|
int
|
Frames per second for the animation |
60
|
Source code in arabic_animations/core/scene.py
add(*objects, serial=False)
Add objects to the scene.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*objects
|
Any
|
One or more objects to add to the scene |
()
|
serial
|
bool
|
If True, objects will animate one after another. If False, they animate simultaneously. |
False
|
Source code in arabic_animations/core/scene.py
render_frame(t)
Render a single frame at time t.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time in seconds |
required |
Returns:
Type | Description |
---|---|
ndarray
|
A numpy array representing the frame in RGBA format |
Source code in arabic_animations/core/scene.py
Usage Examples
Basic Scene Setup
from arabic_animations.core.scene import Scene
# Create a scene with default settings (1920x1080, 60fps)
scene = Scene()
# Create a scene with custom settings
scene = Scene(
width=1280,
height=720,
fps=30
)
Adding Objects
# Add a single object
scene.add(text)
# Add multiple objects in parallel
scene.add(text1, text2, serial=False)
# Add multiple objects serially
scene.add(text1, text2, serial=True)