VisibleOnScreenNotifier2D
A rectangular region of 2D space that detects whether it is visible on screen.
VisibleOnScreenNotifier2D.swift:22class VisibleOnScreenNotifier2D
VisibleOnScreenEnabler2D
represents a rectangular region of 2D space. When any part of this region becomes visible on screen or in a viewport, it will emit a [signal screen_entered] signal, and likewise it will emit a [signal screen_exited] signal when no part of it remains visible.
If you want a node to be enabled automatically when this region is visible on screen, use VisibleOnScreenEnabler2D
.
This object emits the following signals:
Superclasses
class Node2D
A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var rect: Rect2
The VisibleOnScreenNotifier2D’s bounding rectangle.
var screenEntered: SimpleSignal
Emitted when the VisibleOnScreenNotifier2D enters the screen.
var screenExited: SimpleSignal
Emitted when the VisibleOnScreenNotifier2D exits the screen.
func isOnScreen(
) -> Bool If
true
, the bounding rectangle is on the screen.
Subclasses
class VisibleOnScreenEnabler2D
A rectangular region of 2D space that, when visible on screen, enables a target node.