Package sprite provides a 2D scene graph for rendering and animation.
A tree of nodes is drawn by a rendering Engine, provided by another package. The OS-independent Go version based on the image package is:
golang.org/x/mobile/exp/sprite/portableAn Engine draws a screen starting at a root Node. The tree is walked depth-first, with affine transformations applied at each level.
Nodes are rendered relative to their parent.
Typical main loop:
for each frame { quantize time.Now() to a clock.Time process UI events modify the scene's nodes and animations (Arranger values) e.Render(scene, t, sz) }This section is empty.
This section is empty.
This section is empty.
A Node is a renderable element and forms a tree of Nodes.
AppendChild adds a node c as a child of n.
It will panic if c already has a parent or siblings.
RemoveChild removes a node c that is a child of n. Afterwards, c will have no parent and no siblings.
It will panic if c's parent is not n.