diff --git a/examples/game/lib/node.dart b/examples/game/lib/node.dart index 878b06ec7bd32e53f490ce7a68624dde41d218fc..b03e36abaf29b5b2f7eb2a03a6d829bfa049959b 100644 --- a/examples/game/lib/node.dart +++ b/examples/game/lib/node.dart @@ -65,6 +65,9 @@ class Node { ActionController _actions; + /// The [ActionController] associated with this node. + /// + /// myNode.actions.run(myAction); ActionController get actions { if (_actions == null) { _actions = new ActionController(); @@ -119,6 +122,9 @@ class Node { invalidateTransformMatrix(); } + /// The skew along the x-axis of this node in degrees. + /// + /// myNode.skewX = 45.0; double get skewX => _skewX; void set skewX (double skewX) { @@ -127,6 +133,9 @@ class Node { invalidateTransformMatrix(); } + /// The skew along the y-axis of this node in degrees. + /// + /// myNode.skewY = 45.0; double get skewY => _skewY; void set skewY (double skewY) { @@ -289,6 +298,9 @@ class Node { return _transformMatrix; } + /// Computes the transformation matrix of this node. This method can be + /// overriden if a custom matrix is required. There is usually no reason to + /// call this method directly. Matrix4 computeTransformMatrix() { double cx, sx, cy, sy; @@ -326,6 +338,9 @@ class Node { return matrix; } + /// Invalidates the current transform matrix. If the [computeTransformMatrix] + /// method is overidden, this method should be called whenever a property + /// changes that affects the matrix. void invalidateTransformMatrix() { _transformMatrix = null; _invalidateToBoxTransformMatrix(); diff --git a/examples/game/lib/node3d.dart b/examples/game/lib/node3d.dart index 0f022c41df8112d7b65350e7682ebc8dc4a82482..7b27bfae59c17d4fdd49203098532d362d8b576d 100644 --- a/examples/game/lib/node3d.dart +++ b/examples/game/lib/node3d.dart @@ -1,9 +1,16 @@ part of sprites; +/// An node that transforms its children using a 3D perspective projection. This +/// node type can be used to create 3D flips and other similar effects. +/// +/// var myNode3D = new Node3D(); +/// myNode3D.rotationY = 45.0; +/// myNode3D.addChild(new Sprite(myTexture)); class Node3D extends Node { double _rotationX = 0.0; + /// The node's rotation around the x axis in degrees. double get rotationX => _rotationX; set rotationX(double rotationX) { @@ -13,6 +20,7 @@ class Node3D extends Node { double _rotationY = 0.0; + /// The node's rotation around the y axis in degrees. double get rotationY => _rotationY; set rotationY(double rotationY) { @@ -22,6 +30,7 @@ class Node3D extends Node { double _projectionDepth = 500.0; + /// The projection depth. Default value is 500.0. double get projectionDepth => _projectionDepth; set projectionDepth(double projectionDepth) {