simvx.core.nodes_2d.background_bands¶
BackgroundBands / SkyHorizon: horizontal colour bands relative to the camera.
Renders a stack of full-width horizontal stripes that fill the visible viewport. Useful for sky / sea / cave-tier backdrops where you want a few solid bands (or gradient bands) without authoring a backdrop texture.
Two scroll modes:
world_space=True(default): bands are anchored at fixed world-Y values: the camera can scroll past them, so a “horizon” stays put.world_space=False: bands lock to the screen: the sky always stays at the top of the viewport, irrespective of camera Y. Equivalent to parenting aNode2Dunder aCanvasLayer.
A band entry is (top_y, colour, [bottom_colour]):
top_y: Y in the chosen space (world or screen) for the top of this band. Bands are sorted ascending; each band extends down to the next band’stop_y(or the viewport bottom for the last band).colour: solid RGBA fill, or top colour for a vertical gradient.bottom_colour: optional; if given, the band is a vertical gradient fromcolour(top) tobottom_colour(bottom).
Module Contents¶
Classes¶
Horizontal colour bands that follow the camera. |
Data¶
API¶
- simvx.core.nodes_2d.background_bands.Band¶
None
- class simvx.core.nodes_2d.background_bands.BackgroundBands(bands: collections.abc.Sequence[simvx.core.nodes_2d.background_bands.Band] | None = None, world_space: bool = True, **kwargs)[source]¶
Bases:
simvx.core.nodes_2d.node2d.Node2DHorizontal colour bands that follow the camera.
Example: sky / sea horizon at world-Y = 0::
bg = root.add_child(BackgroundBands()) bg.bands = [ (-1e9, (0.4, 0.7, 1.0, 1.0), (0.7, 0.85, 1.0, 1.0)), # sky (0.0, (0.1, 0.3, 0.6, 1.0), (0.05, 0.15, 0.4, 1.0)), # sea ]Initialization
- world_space¶
‘Property(…)’
- property bands: list[simvx.core.nodes_2d.background_bands.Band][source]¶
- add_band(top_y: float, colour: tuple[float, ...], bottom_colour: tuple[float, ...] | None = None) None[source]¶
Append a band entry. Bands are sorted by
top_yat draw time.
- position¶
‘_SpatialVecProperty(…)’
- rotation¶
‘Property(…)’
- scale¶
‘_SpatialVecProperty(…)’
- z_index¶
‘Property(…)’
- z_as_relative¶
‘Property(…)’
- render_layer¶
‘Property(…)’
- set_render_layer(index: int, enabled: bool = True) None¶
- is_on_render_layer(index: int) bool¶
- property absolute_z_index: int¶
- property rotation_degrees: float¶
- property world_position: simvx.core.math.types.Vec2¶
- property world_rotation: float¶
- property world_scale: simvx.core.math.types.Vec2¶
- property world_transform: tuple[simvx.core.math.types.Vec2, simvx.core.math.types.Vec2, float]¶
- property forward: simvx.core.math.types.Vec2¶
- property right: simvx.core.math.types.Vec2¶
- translate(offset: tuple[float, float] | numpy.ndarray)¶
- rotate(radians: float)¶
- rotate_deg(degrees: float)¶
- look_at(target: tuple[float, float] | numpy.ndarray)¶
- transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]¶
- draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)¶
- wrap_screen(margin: float = 20)¶
- strict_errors: ClassVar[bool]¶
True
- script_error_raised¶
‘Signal(…)’
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property process_mode: simvx.core.descriptors.ProcessMode¶
- property visible: bool¶
- reset_error() None¶
- add_child(node: simvx.core.node.Node) simvx.core.node.Node¶
- remove_child(node: simvx.core.node.Node)¶
- reparent(new_parent: simvx.core.node.Node)¶
- get_node(path: str) simvx.core.node.Node¶
- find_child(name: str, recursive: bool = False) simvx.core.node.Node | None¶
- find(target: type | str, recursive: bool = True) simvx.core.node.Node | None¶
- walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]¶
- property path: str¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- on_ready() None¶
- on_enter_tree() None¶
- on_exit_tree() None¶
- on_process(dt: float) None¶
- on_physics_process(dt: float) None¶
- on_picked(event: simvx.core.events.InputEvent) None¶
- on_unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- clear_children()¶
- destroy()¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶