ThreeSceneController class

Server-safe controller for a browser Three.js scene canvas.

Browser builds attach this controller to a canvas and expose the global THREE object when an app has loaded Three.js. Server and VM builds keep the same API without touching browser globals.

Constructors

ThreeSceneController({ThreeSceneAttachCallback? onAttach, ThreeSceneFrameCallback? onFrame, ThreeSceneDisposeCallback? onDispose, bool autoStart = true})
Creates a Three.js scene controller.

Properties

autoStart bool
Whether the browser controller should start animation on attach.
final
canvas Object?
The attached canvas element in browser builds.
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
The canvas height in pixels.
no setter
isAttached bool
Whether this controller is attached to a canvas.
no setter
isSupported bool
Whether this build can access browser APIs.
no setter
isThreeAvailable bool
Whether a global THREE object is available.
no setter
onAttach ThreeSceneAttachCallback?
Runs after the controller attaches to a canvas in browser builds.
final
onDispose ThreeSceneAttachCallback?
Runs when dispose is called.
final
onFrame ThreeSceneFrameCallback?
Runs during the animation loop in browser builds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
three Object?
The global THREE object in browser builds.
no setter
width int
The canvas width in pixels.
no setter

Methods

attachTo(Object? element) → void
Attaches this controller to element in browser builds.
callMethod(Object? target, String method, [List<Object?> args = const []]) Object?
Calls method on a JavaScript target object in browser builds.
create(String constructor, [List<Object?> args = const []]) Object?
Creates a Three.js object from a constructor on the global THREE object.
detach() → void
Detaches this controller from its canvas.
dispose() → void
Stops animation, releases browser resources, and calls onDispose.
disposeObject(Object? target) → void
Calls dispose() on target when that method exists in browser builds.
getProperty(Object? target, String property) Object?
Reads a JavaScript property from target in browser builds.
getThreeProperty(String name) Object?
Reads a property from the global THREE object in browser builds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render([double timestamp = 0]) → void
Requests one render/update frame.
resize({int? width, int? height}) → void
Updates the backing canvas dimensions in browser builds.
setProperty(Object? target, String property, Object? value) → void
Writes a JavaScript property on target in browser builds.
start() → void
Starts the animation loop in browser builds.
stop() → void
Stops the animation loop in browser builds.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited