CGSGSceneGraph Class
Represent the scene graph it self. It encapsulates the root node and list of timelines for animations
Constructor
-
canvas -
context
-
canvasHTMLElementa handler to the canvas HTML element
-
contextCanvasRenderingContext2Dcontext to render on
Item Index
Methods
Properties
Methods
-
node -
attribute -
frame -
value -
method -
precompute
Add a key
-
nodeCGSGNodehandler to the nodes to animate
-
attributeStringString representing the attribute to animate ("position.y", "rotation.angle", "fill", ...)
-
frameNumberthe date for the key
-
valueNumbervalue for the attribute at the frame
-
methodStringanimation method. Must be 'linear' for now
-
precomputeBooleanSet to true if you want to precompute the animations steps
this.sceneGraph.addAnimation(imgNode, "position.x", 2000, 200, "linear", true);
-
node -
parent
Add a nodes on the scene. If the root does not already exist, this nodes will be used as root
-
node -
attribute -
duration -
from -
to -
method -
delay -
precompute
Animate an attribute of a nodes
-
nodeCGSGNodeHandler to the nodes to animate
-
attributeStringString representing the attribute to animate ("position.y", "rotation.angle", "fill", ...)
-
durationNumberDuration of the animation, in frame
-
fromNumberStart value
-
toNumberEnd value
-
methodStringAnimation method. Must be 'linear' for now
-
delayNumberDelay before start the animation, in frames
-
precomputeBooleanSet to true if you want to precompute the animations steps
this.sceneGraph.animate(imgNode, "position.x", 700, 0, 200, "linear", 0, true);
-
excludedArray
Mark all nodes as not selected
-
excludedArrayArrayCGSGNodes to not deselect
-
node -
attribute
Return the timeline corresponding with the nodes and attribute. Create it if does not exists yet
-
width -
height
Initialize the ghost rendering, used by the PickNode function
-
mousePosition -
condition
Recursively traverse the nodes and return the one who is under the mouse coordinates
-
mousePositionCGSGPosition -
conditionString
this.scenegraph.picknode(mousePosition, 'position.x > 100');
this.scenegraph.picknode(mousePosition, 'position.x > 100 && this.position.y > 100');
-
region -
condition
Recursively traverse the nodes and return the ones who are under the mouse coordinates
-
regionCGSGRegion -
conditionString
this.scenegraph.picknodes(region, 'position.x > 100');
this.scenegraph.picknodes(region, 'position.x > 100 && this.position.y > 100');
-
node
Remove the child nodes passed in parameter, from the root nodes
-
nodeCGSGNodethe nodes to remove
Render the SceneGraph
-
nodeToSelect
Mark the nodes as selected so the select marker (also called selectedHandlers) will be shown and the SceneGraph will manage the moving and resizing of the selected objects.
-
nodeToSelectObjectThe CGSGNode to be selected
-
newDimension
Change the dimension of the canvas. Does not really change the dimension of the rendering canvas container, but is used for different computations
-
newDimensionCGSGDimension
Properties
List of the timelines for the animations. A timeline consists of a list of animation keys for 1 attribute of the nodes
Initialize a ghost canvas used to determine which nodes are selected by the user