File: AnimationClip.html

package info (click to toggle)
three.js 111%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,212 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (145 lines) | stat: -rw-r--r-- 4,787 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!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>

		<p class="desc">
			An AnimationClip is a reusable set of keyframe tracks which represent an animation.<br /><br />

			For an overview of the different elements of the three.js animation system see the
			"Animation System" article in the "Next Steps" section of the manual.
		</p>


		<h2>Constructor</h2>


		<h3>[name]( [param:String name], [param:Number duration], [param:Array tracks] )</h3>
		<p>
			[page:String name] - a name for this clip.<br />
			[page:Number duration] - the duration of this clip (in seconds). If a negative value is passed,
			the duration will be calculated from the passed *tracks* array.<br />
			[page:Array tracks] - an array of [page:KeyframeTrack KeyframeTracks].<br /><br />

			Note: Instead of instantiating an AnimationClip directly with the constructor, you can use one
			of its static methods to create AnimationClips: from JSON ([page:.parse parse]), from morph
			target sequences ([page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence],
			[page:.CreateClipsFromMorphTargetSequences CreateClipsFromMorphTargetSequences]) or from
			animation hierarchies ([page:.parseAnimation parseAnimation]) - if your model doesn't already
			hold AnimationClips in its geometry's animations array.
		</p>


		<h2>Properties</h2>


		<h3>[property:Number duration]</h3>
		<p>
			The duration of this clip (in seconds). This can be calculated from the [page:.tracks tracks]
			array via [page:.resetDuration resetDuration].
		</p>

		<h3>[property:String name]</h3>
		<p>
			A name for this clip. A certain clip can be searched via [page:.findByName findByName].
		</p>

		<h3>[property:Array tracks]</h3>
		<p>
			An array containing a [page:KeyframeTrack] for each property that are animated by this clip.
		</p>

		<h3>[property:String uuid]</h3>
		<p>
			The [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this clip instance.
			It gets automatically assigned and shouldn't be edited.
		</p>


		<h2>Methods</h2>


		<h3>[method:AnimationClip clone]()</h3>
		<p>
			Returns a copy of this clip.
		</p>

		<h3>[method:this optimize]()</h3>
		<p>
			Optimizes each track by removing equivalent sequential keys (which are common in morph target
			sequences).
		</p>

		<h3>[method:this resetDuration]()</h3>
		<p>
			Sets the [page:.duration duration] of the clip to the duration of its longest
			[page:KeyframeTrack].
		</p>

		<h3>[method:this trim]()</h3>
		<p>
			Trims all tracks to the clip's duration.
		</p>

		<h3>[method:Boolean validate]()</h3>
		<p>
			Performs minimal validation on each track in the clip. Returns true if all tracks are valid.
		</p>


		<h2>Static Methods</h2>


		<h3>[method:Array CreateClipsFromMorphTargetSequences]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
		<p>
			Returns an array of new AnimationClips created from the [page:Geometry.morphTargets morph
			target sequences] of a geometry, trying to sort morph target names into animation-group-based
			patterns like "Walk_001, Walk_002, Run_001, Run_002 ...".
		</p>

		<h3>[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
		<p>
			Returns a new AnimationClip from the passed [page:Geometry.morphTargets morph targets array]
			of a geometry, taking a name and the number of frames per second.<br /><br />

			Note: The fps parameter is required, but the animation speed can be overridden in an
			*AnimationAction* via [page:AnimationAction.setDuration animationAction.setDuration].
		</p>

		<h3>[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )</h3>
		<p>
			Searches for an AnimationClip by name, taking as its first parameter either an array of
			AnimationClips, or a mesh or geometry that contains an array named "animations".
		</p>

		<h3>[method:AnimationClip parse]( [param:Object json] )</h3>
		<p>
			Parses a JSON representation of a clip and returns an AnimationClip.
		</p>

		<h3>[method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )</h3>
		<p>
			Parses the animation.hierarchy format and returns an AnimationClip.
		</p>

		<h3>[method:Object toJSON]( [param:AnimationClip clip] )</h3>
		<p>
			Takes an AnimationClip and returns a JSON object.
		</p>


		<h2>Source</h2>


		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
		</p>
	</body>
</html>