VElement
VElement
Central object that combines a renderer with its state(s)
Can be used for static rendering (single state) or animation (keyframes/states). This is the main object users work with.
Constructor
VElement(self, renderer: 'Renderer', state: 'Optional[State]' = None, states: 'Optional[List[State]]' = None, keyframes: 'Optional[List[Tuple[float, State]]]' = None, easing: 'Optional[Dict[str, Callable[[float], float]]]' = None) -> 'None'
Initialize an element
Args: renderer: The renderer to render state: Single state for static element states: List of states for evenly-timed animation keyframes: List of (frame_time, state) tuples for precise timing easing: Optional dict to override default easing functions
Methods
is_animatable(self) -> 'bool'
Check if this element can be animated
Returns: True if element has multiple keyframes
render(self) -> 'dw.DrawingElement'
Render the element in its current state (static rendering)
Returns: drawsvg element representing the element
render_at_frame_time(self, t: 'float') -> 'dw.DrawingElement'
Render the element at a specific animation frame_time
Args: t: frame_time factor from 0.0 to 1.0
Returns: drawsvg element representing the element at frame_timeframe_time t
set_keyframes(self, keyframes: 'List[Tuple[float, State]]') -> 'None'
Set explicit keyframes
set_state(self, state: 'State') -> 'None'
Set a single static state
set_states(self, states: 'List[State]') -> 'None'
Set evenly-timed states