Ver código fonte

Created documentation for missing Animation classes (#10070)

* Added animation menu items

* created docs for AnimationsObjectGroup and AnimationUtils

* Added doc for KeyframeTrack

* Added doc for PropertyBinding

* Created doc for PropertyMixer
Lewy Blue 8 anos atrás
pai
commit
0b1cf37167

+ 74 - 0
docs/api/animation/AnimationObjectGroup.html

@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <base href="../../" />
+    <script src="list.js"></script>
+    <script src="page.js"></script>
+    <link type="text/css" rel="stylesheet" href="page.css" />
+  </head>
+  <body>
+    <h1>[name]</h1>
+
+    <div class="desc">A group of objects that receives a shared animation state.</div>
+
+    <h2>Usage:</h2>
+
+    <div>
+      Add objects you would otherwise pass as 'root' to the	constructor or the [page:AnimationMixer.clipAction clipAction]
+      method of [page:AnimationMixer AnimationMixer] and instead pass this object as 'root'.<br /><br />
+
+      Note that objects of this class appear as one object to the mixer,
+      so cache control of the individual objects must be done	on the group.
+    </div>
+
+
+   <h2>Limitations</h2>
+   <div>
+    The animated properties must be compatible among all objects in the group.<br /><br />
+
+    A single property can either be controlled through a target group or directly, but not both.
+    </div>
+
+
+    <h2>Constructor</h2>
+
+
+    <h3>[name]( [page:object obj1], [page:object obj2], [page:object obj3], ... )</h3>
+
+
+    <h2>Properties</h2>
+
+    <h3>[property:object stats]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number timeScale]</h3>
+
+
+    <h2>Methods</h2>
+
+
+    <h3>[method:null add]( [page:object obj1], [page:object obj2], [page:object obj3], ... )</h3>
+    <div>
+
+    </div>
+
+    <h3>[method:null remove]( [page:object obj1], [page:object obj2], [page:object obj3], ... )</h3>
+    <div>
+
+    </div>
+
+    <h3>[method:null uncache]( [page:object obj1], [page:object obj2], [page:object obj3], ... )</h3>
+    <div>
+
+    </div>
+
+
+    <h2>Source</h2>
+
+
+    [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+  </body>
+</html>

+ 54 - 0
docs/api/animation/AnimationUtils.html

@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <base href="../../" />
+    <script src="list.js"></script>
+    <script src="page.js"></script>
+    <link type="text/css" rel="stylesheet" href="page.css" />
+  </head>
+  <body>
+    <h1>[name]</h1>
+
+    <div class="desc">
+    An object with various functions to assist with animations.
+    </div>
+
+    <h2>Methods</h2>
+
+    <h3>[method:Array arraySlice]( array, from, to )</h3>
+    <div>
+    Convert an array to a specific type.
+    </div>
+
+    <h3>[method:Array convertArray]( array, type, forceClone )</h3>
+    <div>
+    This is the same as  Array.prototype.slice, but also works on typed arrays.
+    </div>
+
+    <h3>[method:Boolean isTypedArray]( object )</h3>
+    <div>
+    Return *true* if the object is a typed array.
+    </div>
+
+    <h3>[method:Array getKeyframeOrder]( times )</h3>
+    <div>
+    Returns an array by which times and values can be sorted.
+    </div>
+
+    <h3>[method:Array sortedArray]( values, stride, order )</h3>
+    <div>
+    Sort the array previously returned by [page:AnimationUtils.getKeyframeOrder getKeyframeOrder].
+    </div>
+
+    <h3>[method:Array flattenJSON]( jsonKeys, times, values, valuePropertyName  )</h3>
+    <div>
+    Used for parsing AOS keyframe formats
+    </div>
+
+    <h2>Source</h2>
+
+
+    [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+  </body>
+</html>

+ 154 - 0
docs/api/animation/KeyframeTrack.html

@@ -0,0 +1,154 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <base href="../../" />
+    <script src="list.js"></script>
+    <script src="page.js"></script>
+    <link type="text/css" rel="stylesheet" href="page.css" />
+  </head>
+  <body>
+
+    <h1>[name]</h1>
+
+    <div class="desc">
+    A timed sequence of [link:https://en.wikipedia.org/wiki/Key_frame keyframes] for animating
+    a specific property of an object.
+    </div>
+
+
+    <h2>Constructor</h2>
+
+
+    <h3>[name]( [page:String name], [page:Array times], [page:Array values], [page:Constant interpolation] )</h3>
+    <div>
+      -- [page:String name] (required) identifier for the KeyframeTrack.<br />
+      -- [page:Array times] (required) array of keyframe times<br />
+      -- [page:Array values] values for the keyframes at the times specified.<br />
+      -- [page:Constant interpolation] the type of interpolation to use. See [page:Animation Animation Constants] for possible values.
+      Default is [page:Animation InterpolateLinear].
+    </div>
+
+    <h2>Properties</h2>
+
+
+    <h3>[property:String name]</h3>
+    <div>
+    The name given to the KeyframeTrack in the constructor.
+    </div>
+
+    <h3>[property:Float32Array times]</h3>
+    <div>
+    [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array]
+    of keyframe times.
+    </div>
+
+    <h3>[property:Float32Array values]</h3>
+    <div>
+    [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array]
+    of keyframe values, corresponding to the [page:KeyframeTrack.times times].
+    </div>
+
+    <h3>[property:Constant DefaultInterpolation]</h3>
+    <div>
+    The default tnterpolation type to use, [page:Animation InterpolateLinear].
+    </div>
+
+
+    <h2>Methods</h2>
+
+    <h3>[method:null createInterpolant ](  )</h3>
+    <div>
+      Create a [page:LinearInterpolant LinearInterpolant], [page:CubicInterpolant CubicInterpolant]
+      or [page:DiscreteInterpolant DiscreteInterpolant], depending on the value of the interpolation parameter
+      passed in the constructor.
+    </div>
+
+    <h3>[method:null getInterpolation ](  )</h3>
+    <div>
+      Get the interpolation type.
+    </div>
+
+    <h3>[method:Number getValueSize ](  )</h3>
+    <div>
+      The the size of each value (length of the values array divied by length of times array).
+    </div>
+
+    <h3>[method:DiscreteInterpolant InterpolantFactoryMethodDiscrete ]( result )</h3>
+    <div>
+      Create a new [page:DiscreteInterpolant DiscreteInterpolant] from the [page:KeyframeTrack.times times]
+      and [page:KeyframeTrack.times values].
+    </div>
+
+    <h3>[method:null InterpolantFactoryMethodLinear ](  )</h3>
+    <div>
+      Create a new [page:LinearInterpolant LinearInterpolant] from the [page:KeyframeTrack.times times]
+      and [page:KeyframeTrack.times values].
+    </div>
+
+    <h3>[method:null InterpolantFactoryMethodSmooth ](  )</h3>
+    <div>
+      Create a new [page:CubicInterpolant CubicInterpolant] from the [page:KeyframeTrack.times times]
+      and [page:KeyframeTrack.times values].
+    </div>
+
+    <h3>[method:null optimize ](  )</h3>
+    <div>
+      Remove equivalent sequential keys, which are common in morph target sequences. <br />
+  	  Called automatically by the constructor.
+    </div>
+
+    <h3>[method:KeyframeTrack parse]( [page:JSON json] )</h3>
+    <div>
+    Parse json and return new keyframe track of the correct type.
+    </div>
+
+    <h3>[method:null scale ](  )</h3>
+    <div>
+      Scale all keyframe times by a factor (useful for frame <-> seconds conversions).
+    </div>
+
+    <h3>[method:null setInterpolation ]( [page:Constant interpolation] )</h3>
+    <div>
+      Set the interpolation type. See [page:Animation animation constants] for choices.
+    </div>
+
+    <h3>[method:null shift ]( [page:Number timeOffset] )</h3>
+    <div>
+      Move all keyframes either forwards or backwards in time.
+    </div>
+
+    <h3>[method:null TimeBufferType ](  )</h3>
+    <div>
+      [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array],
+      used to convert the times array passed in the constructor to a Float32Array.
+    </div>
+
+    <h3>[method:JSON toJSON]( [page:KeyframeTrack track] )</h3>
+    <div>
+    Convert the track to JSON.
+    </div>
+
+    <h3>[method:null trim ]( [page:Number startTime], [page:Number endTime] )</h3>
+    <div>
+      Removes keyframes before [page:Number startTime] and after [page:Number endTime]
+      without changing any values within the range [[page:Number startTime], [page:Number endTime]].
+    </div>
+
+    <h3>[method:null validate ](  )</h3>
+    <div>
+      Perform minimal validation on the tracks. Called automatically by the constructor.
+    </div>
+
+    <h3>[method:null ValueBufferType ](  )</h3>
+    <div>
+      [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array],
+      used to convert the values array passed in the constructor to a Float32Array.
+    </div>
+
+    <h2>Source</h2>
+
+
+    [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+  </body>
+</html>

+ 131 - 0
docs/api/animation/PropertyBinding.html

@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <base href="../../" />
+    <script src="list.js"></script>
+    <script src="page.js"></script>
+    <link type="text/css" rel="stylesheet" href="page.css" />
+  </head>
+  <body>
+    <h1>[name]</h1>
+
+    <div class="desc">
+    This holds a reference to a real property in the scene graph.
+    </div>
+
+
+    <h2>Constructor</h2>
+
+
+    <h3>[name]( [page:Object3D rootNode], path, parsedPath )</h3>
+    <div>
+      -- [page:Object3D rootNode]:
+      -- path
+      -- parsedPath (optional)
+
+    </div>
+
+    <h2>Properties</h2>
+
+    <h3>[property:Number path]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number parsedPath]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number node]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number rootNode]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Object BindingType]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Object Versioning]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Array GetterByBindingType]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Array SetterByBindingTypeAndVersioning]</h3>
+    <div>
+
+    </div>
+
+
+
+    <h2>Methods</h2>
+
+    <h3>[method:null getValue]( [page:Array targetArray], [page:Number offset] )</h3>
+    <div>
+    </div>
+
+    <h3>[method:null setValue]( [page:Array sourceArray], [page:Number offset] )</h3>
+    <div>
+    </div>
+
+    <h3>[method:null bind]( )</h3>
+    <div>
+      Create getter / setter pair for a property in the scene graph. Used internally by
+      [page:PropertyBinding.getValue getValue] and [page:PropertyBinding.setValue setValue].
+    </div>
+
+    <h3>[method:null unbind]( )</h3>
+    <div>
+      Unbind getter / setter pair for a property in the scene graph.
+    </div>
+
+    <h3>[method:Constructor Composite]( targetGroup, path, optionalParsedPath )</h3>
+    <div>
+      Create a new Composite PropertyBinding.
+    </div>
+
+    <h3>[method:Constructor create]( root, path, parsedPath )</h3>
+    <div>
+      Create a new Composite PropertyBinding (if root is an [page:AnimationObjectGroup]) or PropertyBinding.
+    </div>
+
+    <h3>[method:Constructor parseTrackName]( trackName )</h3>
+    <div>
+      Matches strings in the following forms:<br />
+      -- nodeName.property<br />
+      -- nodeName.property[accessor]<br />
+      -- nodeName.material.property[accessor]<br />
+      -- uuid.property[accessor]<br />
+      -- uuid.objectName[objectIndex].propertyName[propertyIndex]<br />
+      -- parentName/nodeName.property<br />
+      -- parentName/parentName/nodeName.property[index]<br />
+      -- .bone[Armature.DEF_cog].position<br />
+      -- scene:helium_balloon_model:helium_balloon_model.position
+    </div>
+
+    <h3>[method:Constructor findNode]( root, nodeName )</h3>
+    <div>
+      Find a node in a node tree or [page:Skeleton Skeleton].
+    </div>
+
+
+
+
+    <h2>Source</h2>
+
+
+    [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+  </body>
+</html>

+ 99 - 0
docs/api/animation/PropertyMixer.html

@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <base href="../../" />
+    <script src="list.js"></script>
+    <script src="page.js"></script>
+    <link type="text/css" rel="stylesheet" href="page.css" />
+  </head>
+  <body>
+    <h1>[name]</h1>
+
+    <div class="desc">
+    Buffered scene graph property that allows weighted accumulation.
+    </div>
+
+
+    <h2>Constructor</h2>
+
+
+    <h3>[name]( binding, typeName, valueSize )</h3>
+    <div>
+      -- binding <br />
+      -- typeName <br />
+      -- valueSize <br />
+    </div>
+
+
+    <h2>Properties</h2>
+
+
+    <h3>[property:Number binding]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number buffer]</h3>
+    <div>
+      Buffer with size [page:PropertyMixer valueSize] * 4. <br /><br />
+      This has the layout: [ incoming | accu0 | accu1 | orig ]<br /><br />
+      Interpolators can use .buffer as their .result and the data then goes to 'incoming'.<br />
+      'accu0' and 'accu1' are used frame-interleaved for the cumulative result and
+      are compared to detect changes.<br />
+      'orig' stores the original state of the property.<br />
+    </div>
+
+    <h3>[property:Number cumulativeWeight]</h3>
+    <div>
+      Default is *0*.
+    </div>
+
+    <h3>[property:Number valueSize]</h3>
+    <div>
+
+    </div>
+
+    <h3>[property:Number referenceCount]</h3>
+    <div>
+      Default is *0*.
+    </div>
+
+    <h3>[property:Number useCount]</h3>
+    <div>
+      Default is *0*.
+    </div>
+
+
+    <h2>Methods</h2>
+
+
+    <h3>[method:null accumulate]( accuIndex, weight )</h3>
+    <div>
+      Accumulate data in [page:PropertyMixer.buffer buffer][accuIndex] 'incoming' region into 'accu[i]'.<br />
+
+      If weight is *0* this does nothing.
+    </div>
+
+    <h3>[method:null apply]( accuIndex )</h3>
+    <div>
+      Apply the state of [page:PropertyMixer.buffer buffer] 'accu[i]' to the binding when accus differ.
+    </div>
+
+    <h3>[method:null saveOriginalState]( )</h3>
+    <div>
+      Remember the state of the bound property and copy it to both accus.
+    </div>
+
+    <h3>[method:null restoreOriginalState](  )</h3>
+    <div>
+      Apply the state previously taken via 'saveOriginalState' to the binding.
+    </div>
+
+
+    <h2>Source</h2>
+
+
+    [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+  </body>
+</html>

+ 21 - 6
docs/list.js

@@ -8,6 +8,27 @@ var list = {
 	},
 
 	"Reference": {
+
+		"Animation": [
+			[ "AnimationAction", "api/animation/AnimationAction" ],
+			[ "AnimationClip", "api/animation/AnimationClip" ],
+			[ "AnimationMixer", "api/animation/AnimationMixer" ],
+			[ "AnimationObjectGroup", "api/animation/AnimationObjectGroup" ],
+			[ "AnimationUtils", "api/animation/AnimationUtils" ],
+			[ "KeyframeTrack", "api/animation/KeyframeTrack" ],
+			[ "PropertyBinding", "api/animation/PropertyBinding" ],
+			[ "PropertyMixer", "api/animation/PropertyMixer" ]
+		],
+
+		"Audio": [
+			[ "Audio", "api/audio/Audio" ],
+			[ "AudioAnalyser", "api/audio/AudioAnalyser" ],
+			[ "AudioContext", "api/audio/AudioContext" ],
+			[ "AudioListener", "api/audio/AudioListener" ],
+			[ "PositionalAudio", "api/audio/PositionalAudio" ]
+		],
+
+
 		"Audio": [
 			[ "Audio", "api/audio/Audio" ],
 			[ "AudioAnalyser", "api/audio/AudioAnalyser" ],
@@ -237,12 +258,6 @@ var list = {
 			[ "VideoTexture", "api/textures/VideoTexture" ]
 		],
 
-		"Animation": [
-			[ "AnimationAction", "api/animation/AnimationAction" ],
-			[ "AnimationClip", "api/animation/AnimationClip" ],
-			[ "AnimationMixer", "api/animation/AnimationMixer" ]
-		],
-
 		"Extras": [
 			[ "CurveUtils", "api/extras/CurveUtils" ],
 			[ "SceneUtils", "api/extras/SceneUtils" ],