Skip to content

Commit 6663308

Browse files
committed
document property class
1 parent 107481d commit 6663308

File tree

1 file changed

+50
-8
lines changed

1 file changed

+50
-8
lines changed

src/index.ts

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,37 +282,79 @@ class Property<PropertyValueType extends Value> {
282282
loopOutDuration(type: loopType = "cycle", duration: number = 0): Value {
283283
return this.value;
284284
}
285-
285+
/**
286+
* The temporal velocity value at the current time. For spatial properties, such as Position, it returns the tangent vector value. The result is the same dimension as the property.
287+
*/
286288
readonly velocity: PropertyValueType = this.value;
289+
/**
290+
* @returns The temporal velocity value at the specified time. For spatial properties, such as Position, it returns the tangent vector value. The result is the same dimension as the property.
291+
* @param time The composition time in seconds to get the velocity at
292+
*/
287293
velocityAtTime(time: number): PropertyValueType {
288294
return this.velocity;
289295
}
296+
/**
297+
* A 1D, positive speed value equal to the speed at which the property is changing at the default time. This element can be used only for spatial properties.
298+
*/
290299
readonly speed: PropertyValueType = this.value;
300+
/**
301+
* @returns A 1D, positive speed value equal to the speed at which the property is changing at the specified time. This element can be used only for spatial properties.
302+
* @param time The composition time in seconds to get the speed at
303+
*/
291304
speedAtTime(time: number): PropertyValueType {
292305
return this.speed;
293306
}
307+
/**
308+
* Returns the value for the property at the specified time
309+
* @param time THe composition time in seconds to get the value at
310+
*/
294311
valueAtTime(time: number): PropertyValueType {
295312
return this.value;
296313
}
314+
/**
315+
* Modifies the property value randomly over time.
316+
* @param freq The rate at which the value changes in wiggles per second
317+
* @param amp How much the value should change, in units of the original property value (e.g. `1` by 100% of the original value)
318+
* @param octaves How much detail the wiggle has, which is driven by the number of "octaves" of noise to multiply together. Higher values will have more detail
319+
* @param amp_mult The amount the given amplitude is multiplied by for each octave, which controls the falloff of the upper harmonics ("octaves").
320+
* @param time The time at which the value is sampled for use within the wiggle
321+
*/
297322
wiggle(
298323
freq: number,
299324
amp: number,
300-
octaves?: number,
301-
amp_mult?: number,
302-
time?: number
325+
octaves: number = 1,
326+
amp_mult: number = 0.5,
327+
time: number = thisLayer.time
303328
): PropertyValueType {
304329
return this.value;
305330
}
331+
/**
332+
* Samples the property value at a time which is wiggled
333+
* @param freq The rate at which the value changes in wiggles per second
334+
* @param amp How much the value should change, in units of the original property value (e.g. `1` by 100% of the original value)
335+
* @param octaves How much detail the wiggle has, which is driven by the number of "octaves" of noise to multiply together. Higher values will have more detail
336+
* @param amp_mult The amount the given amplitude is multiplied by for each octave, which controls the falloff of the upper harmonics ("octaves").
337+
* @param time The time at which the value is sampled for use within the wiggle
338+
*/
306339
temporalWiggle(
307340
freq: number,
308341
amp: number,
309-
octaves?: number,
310-
amp_mult?: number,
311-
time?: number
342+
octaves: number = 1,
343+
amp_mult: number = 0.5,
344+
time: number = thisLayer.time
312345
): Value {
313346
return this.value;
314347
}
315-
smooth(width?: number, samples?: number, time?: number): Value {
348+
/**
349+
* Smooths the property values over time, converting large, brief deviations in the value to smaller, more evenly distributed deviations. This smoothing is accomplished by applying a box filter to the value of the property at the specified time.
350+
* @param width The range of time (in seconds) over which the filter is averaged.
351+
* @param samples The number of discrete samples evenly spaced over time; use a larger value for greater smoothness (but decreased performance). Generally, you’ll want samples to be an odd number so that the value at the current time is included in the average.
352+
*/
353+
smooth(
354+
width: number = 0.2,
355+
samples: number = 5,
356+
time: number = thisLayer.time
357+
): Value {
316358
return this.value;
317359
}
318360

0 commit comments

Comments
 (0)