Skip to content

Commit c00d55e

Browse files
committed
fix: new Layer() loops
1 parent 41a7cf6 commit c00d55e

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/index.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,22 @@ export type Value =
218218
| PathValue;
219219

220220
export class Property<PropertyValueType extends Value> {
221-
222221
/**
223222
* 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.
224223
*/
225224
readonly velocity: PropertyValueType;
226225

227226
/**
228-
* 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.
229-
*/
227+
* 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.
228+
*/
230229
readonly speed: PropertyValueType;
231-
230+
232231
constructor(
233232
readonly value: PropertyValueType,
234233
readonly name: string = "Property name"
235234
) {
236-
this.velocity = this.value;
237-
this.speed = this.value;
235+
this.velocity = this.value;
236+
this.speed = this.value;
238237
}
239238

240239
/**
@@ -362,7 +361,7 @@ export class Property<PropertyValueType extends Value> {
362361
amp: number,
363362
octaves: number = 1,
364363
amp_mult: number = 0.5,
365-
time: number = new Layer().time
364+
time: number = 0
366365
): PropertyValueType {
367366
const som = freq + amp + octaves + amp_mult + time;
368367
return this.value;
@@ -380,7 +379,7 @@ export class Property<PropertyValueType extends Value> {
380379
amp: number,
381380
octaves: number = 1,
382381
amp_mult: number = 0.5,
383-
time: number = new Layer().time
382+
time: number = 0
384383
): PropertyValueType {
385384
return this.value;
386385
}
@@ -392,7 +391,7 @@ export class Property<PropertyValueType extends Value> {
392391
smooth(
393392
width: number = 0.2,
394393
samples: number = 5,
395-
time: number = new Layer().time
394+
time: number = 0
396395
): PropertyValueType {
397396
return this.value;
398397
}
@@ -429,7 +428,7 @@ export class PathProperty extends Property<PathValue> {
429428
* Retrieves the points array for a path
430429
* @param time The time at which to sample the path
431430
*/
432-
points(time: number = new Layer().time): Points {
431+
points(time: number = 0): Points {
433432
return [
434433
[0, 0],
435434
[0, 0],
@@ -466,10 +465,7 @@ export class PathProperty extends Property<PathValue> {
466465
* @param percentage How far along the path to get the point, between 0 and 1.
467466
* @param time The time at which to sample the path
468467
*/
469-
pointOnPath(
470-
percentage: number = 0.5,
471-
time: number = new Layer().time
472-
): Vector2D {
468+
pointOnPath(percentage: number = 0.5, time: number = 0): Vector2D {
473469
return [0, 0];
474470
}
475471
/**
@@ -739,7 +735,7 @@ export class SourceText extends Property<string> {
739735
* @param characterIndex Which character to get the style at
740736
* @param sampleTime The time to get the style at, defaulting to the current time
741737
*/
742-
getStyleAt(characterIndex: number, sampleTime: number = new Layer().time) {
738+
getStyleAt(characterIndex: number, sampleTime: number = 0) {
743739
return this.style;
744740
}
745741
/**
@@ -964,7 +960,7 @@ export class Layer {
964960
/**
965961
* The parent Layer object of the layer, if it has one
966962
*/
967-
readonly parent?: Layer | Light | Camera = new Layer();
963+
readonly parent?: Layer | Light | Camera = undefined;
968964
/**
969965
* Whether the layer has a parent layer
970966
*/

0 commit comments

Comments
 (0)