SceneView
Displays a SceneKit scene described by Node, Camera and Light records.
<SceneView ... />
Overview
Like SwiftUI's SceneView, the view fills its proposal. The records form
the scene graph and reconcile by id when the template renders again:
nodes keep their pose and running behaviours, changed attributes apply in
place, and transition plays when a node is inserted or removed. Game
state moves nodes every frame with view.nodeStates = {{id, x, y, z, yaw,
pitch, roll, scale, opacity, hidden}, ...} (angles in degrees) without
describing the scene again.
Topics
Properties
| Name | Type | Required | Description |
|---|---|---|---|
background |
string | optional | Color behind the scene (semantic name or #rrggbb). |
onKey |
function | optional | onKey(view, key, pressed) -> handled: presses and releases, never repeats; the view takes the keyboard when it appears. |
onFrame |
function | optional | onFrame(view, dt) once per displayed frame while the view is in a window, dt in seconds. |
onSwipe |
function | optional | onSwipe(view, direction) with left, right, up or down, sent as soon as a drag (a finger, or the mouse) has travelled far enough. |
onTap |
function | optional | onTap(view) when a press is released without travelling. A drag is one swipe or one tap, never both. |
showsStatistics |
boolean | optional | Shows SceneKit's frame-rate and draw-call overlay. |
Example
<SceneView background="#8fd3f4"><Camera position="0 6 8" lookAt="0 0 0" /><Light type="directional" rotation="-60 30 0" castsShadow="true" /><Node model="assets/coin.obj" spin="90" /></SceneView>
Platform notes
- AppKit and UIKit.
Source: lua/embedded/AppKit.lua:2148 (AppKit.SceneView)