Skip to content

Commit

Permalink
improve KeyframeTrack and subtype docs (#28288)
Browse files Browse the repository at this point in the history
* improve KeyframeTrack and subtype docs

* change comment wording, remove unneeded tests

* Update BooleanKeyframeTrack.html

Improve text.

* Update StringKeyframeTrack.html

Improve text.

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
  • Loading branch information
trusktr and Mugen87 authored May 7, 2024
1 parent 37e1cb5 commit bff37d7
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 28 deletions.
6 changes: 5 additions & 1 deletion docs/api/en/animation/tracks/BooleanKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ <h3>
[page:Array times] - (required) array of keyframe times.<br />
[page:Array values] - values for the keyframes at the times specified.<br />
</p>
<p>
This keyframe track type has no interpolation parameter because the
interpolation is always [page:Animation InterpolateDiscrete].
</p>

<h2>Properties</h2>

<p class="desc">See [page:KeyframeTrack] for inherited properties.</p>

<h3>[property:Constant DefaultInterpolation]</h3>
<p>
The default interpolation type to use, [page:Animation InterpolateDiscrete].
The default interpolation type to use. Only [page:Animation InterpolateDiscrete] is valid for this track type.
</p>

<h3>[property:Array ValueBufferType]</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/animation/tracks/ColorKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>[name]</h1>
<h2>Constructor</h2>

<h3>
[name]( [param:String name], [param:Array times], [param:Array values] )
[name]( [param:String name], [param:Array times], [param:Array values], [param:Constant interpolation] )
</h3>
<p>
[page:String name] - (required) identifier for the KeyframeTrack.<br />
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/animation/tracks/NumberKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>[name]</h1>
<h2>Constructor</h2>

<h3>
[name]( [param:String name], [param:Array times], [param:Array values] )
[name]( [param:String name], [param:Array times], [param:Array values], [param:Constant interpolation] )
</h3>
<p>
[page:String name] - (required) identifier for the KeyframeTrack.<br />
Expand Down
10 changes: 5 additions & 5 deletions docs/api/en/animation/tracks/QuaternionKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ <h1>[name]</h1>
<h2>Constructor</h2>

<h3>
[name]( [param:String name], [param:Array times], [param:Array values] )
[name]( [param:String name], [param:Array times], [param:Array values], [param:Constant interpolation] )
</h3>
<p>
[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, a
[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, a
flat array of quaternion components.<br />
[page:Constant interpolation] the type of interpolation to use. See
[page:Constant interpolation] - the type of interpolation to use. See
[page:Animation Animation Constants] for possible values. Default is
[page:Animation InterpolateLinear].
</p>
Expand Down
11 changes: 6 additions & 5 deletions docs/api/en/animation/tracks/StringKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ <h3>
[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 InterpolateDiscrete].
</p>
<p>
This keyframe track type has no interpolation parameter because the
interpolation is always [page:Animation InterpolateDiscrete].
</p>

<h2>Properties</h2>
Expand All @@ -35,7 +36,7 @@ <h2>Properties</h2>

<h3>[property:Constant DefaultInterpolation]</h3>
<p>
The default interpolation type to use, [page:Animation InterpolateDiscrete].
The default interpolation type to use. Only [page:Animation InterpolateDiscrete] is valid for this track type.
</p>

<h3>[property:Array ValueBufferType]</h3>
Expand Down Expand Up @@ -70,4 +71,4 @@ <h2>Source</h2>
</p>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion docs/api/en/animation/tracks/VectorKeyframeTrack.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1>[name]</h1>
<h2>Constructor</h2>

<h3>
[name]( [param:String name], [param:Array times], [param:Array values] )
[name]( [param:String name], [param:Array times], [param:Array values], [param:Constant interpolation] )
</h3>
<p>
[page:String name] - (required) identifier for the KeyframeTrack.<br />
Expand Down
11 changes: 10 additions & 1 deletion src/animation/tracks/BooleanKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
/**
* A Track of Boolean keyframe values.
*/
class BooleanKeyframeTrack extends KeyframeTrack {}
class BooleanKeyframeTrack extends KeyframeTrack {

// No interpolation parameter because only InterpolateDiscrete is valid.
constructor( name, times, values ) {

super( name, times, values );

}

}

BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
BooleanKeyframeTrack.prototype.ValueBufferType = Array;
Expand Down
3 changes: 1 addition & 2 deletions src/animation/tracks/QuaternionKeyframeTrack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { InterpolateLinear } from '../../constants.js';
import { KeyframeTrack } from '../KeyframeTrack.js';
import { QuaternionLinearInterpolant } from '../../math/interpolants/QuaternionLinearInterpolant.js';

Expand All @@ -17,7 +16,7 @@ class QuaternionKeyframeTrack extends KeyframeTrack {

QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';
// ValueBufferType is inherited
QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
// DefaultInterpolation is inherited;
QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;

export { QuaternionKeyframeTrack };
11 changes: 10 additions & 1 deletion src/animation/tracks/StringKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
/**
* A Track that interpolates Strings
*/
class StringKeyframeTrack extends KeyframeTrack {}
class StringKeyframeTrack extends KeyframeTrack {

// No interpolation parameter because only InterpolateDiscrete is valid.
constructor( name, times, values ) {

super( name, times, values );

}

}

StringKeyframeTrack.prototype.ValueTypeName = 'string';
StringKeyframeTrack.prototype.ValueBufferType = Array;
Expand Down
5 changes: 0 additions & 5 deletions test/unit/src/animation/tracks/BooleanKeyframeTrack.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default QUnit.module( 'Animation', () => {
name: '.visible',
times: [ 0, 1 ],
values: [ true, false ],
interpolation: BooleanKeyframeTrack.DefaultInterpolation
};

// INHERITANCE
Expand All @@ -35,10 +34,6 @@ export default QUnit.module( 'Animation', () => {
const object = new BooleanKeyframeTrack( parameters.name, parameters.times, parameters.values );
assert.ok( object, 'Can instantiate a BooleanKeyframeTrack.' );

// name, times, values, interpolation
const object_all = new BooleanKeyframeTrack( parameters.name, parameters.times, parameters.values, parameters.interpolation );
assert.ok( object_all, 'Can instantiate a BooleanKeyframeTrack with name, times, values, interpolation.' );

} );

} );
Expand Down
5 changes: 0 additions & 5 deletions test/unit/src/animation/tracks/StringKeyframeTrack.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default QUnit.module( 'Animation', () => {
name: '.name',
times: [ 0, 1 ],
values: [ 'foo', 'bar' ],
interpolation: StringKeyframeTrack.DefaultInterpolation
};

// INHERITANCE
Expand All @@ -35,10 +34,6 @@ export default QUnit.module( 'Animation', () => {
const object = new StringKeyframeTrack( parameters.name, parameters.times, parameters.values );
assert.ok( object, 'Can instantiate a StringKeyframeTrack.' );

// name, times, values, interpolation
const object_all = new StringKeyframeTrack( parameters.name, parameters.times, parameters.values, parameters.interpolation );
assert.ok( object_all, 'Can instantiate a StringKeyframeTrack with name, times, values, interpolation.' );

} );

} );
Expand Down

0 comments on commit bff37d7

Please sign in to comment.