@dcl/ecs 7.10.5 → 7.10.6-18360040798.commit-8d5d559

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
- import { PBTween, Move, Rotate, Scale, TextureMove } from '../generated/index.gen';
1
+ import { Entity, IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
+ import { Quaternion, Vector2, Vector3 } from '../generated/pb/decentraland/common/vectors.gen';
3
+ import { EasingFunction, Move, MoveContinuous, PBTween, Rotate, RotateContinuous, Scale, TextureMove, TextureMoveContinuous, TextureMovementType } from '../generated/index.gen';
3
4
  /**
4
5
  * @public
5
6
  */
@@ -9,17 +10,29 @@ export interface TweenHelper {
9
10
  */
10
11
  Move: (move: Move) => PBTween['mode'];
11
12
  /**
12
- * @returns a move mode tween
13
+ * @returns a move-continuous mode tween
14
+ */
15
+ MoveContinuous: (move: MoveContinuous) => PBTween['mode'];
16
+ /**
17
+ * @returns a rotate mode tween
13
18
  */
14
19
  Rotate: (rotate: Rotate) => PBTween['mode'];
15
20
  /**
16
- * @returns a move mode tween
21
+ * @returns a rotate-continuous mode tween
22
+ */
23
+ RotateContinuous: (rotate: RotateContinuous) => PBTween['mode'];
24
+ /**
25
+ * @returns a scale mode tween
17
26
  */
18
27
  Scale: (scale: Scale) => PBTween['mode'];
19
28
  /**
20
- * @returns a texture move mode tween
29
+ * @returns a texture-move mode tween
21
30
  */
22
31
  TextureMove: (textureMove: TextureMove) => PBTween['mode'];
32
+ /**
33
+ * @returns a texture-move-continuous mode tween
34
+ */
35
+ TextureMoveContinuous: (textureMove: TextureMoveContinuous) => PBTween['mode'];
23
36
  }
24
37
  /**
25
38
  * @public
@@ -29,5 +42,81 @@ export interface TweenComponentDefinitionExtended extends LastWriteWinElementSet
29
42
  * Texture helpers with constructor
30
43
  */
31
44
  Mode: TweenHelper;
45
+ /**
46
+ * @public
47
+ *
48
+ * Creates or replaces a move tween component that animates an entity's position from start to end
49
+ * @param entity - entity to apply the tween to
50
+ * @param start - starting position vector
51
+ * @param end - ending position vector
52
+ * @param duration - duration of the tween in seconds
53
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
54
+ */
55
+ setMove(entity: Entity, start: Vector3, end: Vector3, duration: number, easingFunction?: EasingFunction): void;
56
+ /**
57
+ * @public
58
+ *
59
+ * Creates or replaces a scale tween component that animates an entity's scale from start to end
60
+ * @param entity - entity to apply the tween to
61
+ * @param start - starting scale vector
62
+ * @param end - ending scale vector
63
+ * @param duration - duration of the tween in seconds
64
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
65
+ */
66
+ setScale(entity: Entity, start: Vector3, end: Vector3, duration: number, easingFunction?: EasingFunction): void;
67
+ /**
68
+ * @public
69
+ *
70
+ * Creates or replaces a rotation tween component that animates an entity's rotation from start to end
71
+ * @param entity - entity to apply the tween to
72
+ * @param start - starting rotation quaternion
73
+ * @param end - ending rotation quaternion
74
+ * @param duration - duration of the tween in seconds
75
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
76
+ */
77
+ setRotate(entity: Entity, start: Quaternion, end: Quaternion, duration: number, easingFunction?: EasingFunction): void;
78
+ /**
79
+ * @public
80
+ *
81
+ * Creates or replaces a texture move tween component that animates texture UV coordinates from start to end
82
+ * @param entity - entity to apply the tween to
83
+ * @param start - starting UV coordinates
84
+ * @param end - ending UV coordinates
85
+ * @param duration - duration of the tween in seconds
86
+ * @param movementType - type of texture movement (defaults to TMT_OFFSET)
87
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
88
+ */
89
+ setTextureMove(entity: Entity, start: Vector2, end: Vector2, duration: number, movementType?: TextureMovementType, easingFunction?: EasingFunction): void;
90
+ /**
91
+ * @public
92
+ *
93
+ * Creates or replaces a continuous move tween component that moves an entity continuously in a direction
94
+ * @param entity - entity to apply the tween to
95
+ * @param direction - direction vector to move towards
96
+ * @param speed - speed of movement per second
97
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
98
+ */
99
+ setMoveContinuous(entity: Entity, direction: Vector3, speed: number, duration?: number): void;
100
+ /**
101
+ * @public
102
+ *
103
+ * Creates or replaces a continuous rotation tween component that rotates an entity continuously
104
+ * @param entity - entity to apply the tween to
105
+ * @param direction - rotation direction quaternion
106
+ * @param speed - speed of rotation per second
107
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
108
+ */
109
+ setRotateContinuous(entity: Entity, direction: Quaternion, speed: number, duration?: number): void;
110
+ /**
111
+ * @public
112
+ *
113
+ * Creates or replaces a continuous texture move tween component that moves texture UV coordinates continuously
114
+ * @param entity - entity to apply the tween to
115
+ * @param direction - direction vector for UV movement
116
+ * @param speed - speed of UV movement per second
117
+ * @param movementType - type of texture movement (defaults to TMT_OFFSET)
118
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
119
+ */
120
+ setTextureMoveContinuous(entity: Entity, direction: Vector2, speed: number, movementType?: TextureMovementType, duration?: number): void;
32
121
  }
33
122
  export declare function defineTweenComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TweenComponentDefinitionExtended;
@@ -6,12 +6,24 @@ const TweenHelper = {
6
6
  move
7
7
  };
8
8
  },
9
+ MoveContinuous(moveContinuous) {
10
+ return {
11
+ $case: 'moveContinuous',
12
+ moveContinuous
13
+ };
14
+ },
9
15
  Rotate(rotate) {
10
16
  return {
11
17
  $case: 'rotate',
12
18
  rotate
13
19
  };
14
20
  },
21
+ RotateContinuous(rotateContinuous) {
22
+ return {
23
+ $case: 'rotateContinuous',
24
+ rotateContinuous
25
+ };
26
+ },
15
27
  Scale(scale) {
16
28
  return {
17
29
  $case: 'scale',
@@ -23,12 +35,118 @@ const TweenHelper = {
23
35
  $case: 'textureMove',
24
36
  textureMove
25
37
  };
38
+ },
39
+ TextureMoveContinuous(textureMoveContinuous) {
40
+ return {
41
+ $case: 'textureMoveContinuous',
42
+ textureMoveContinuous
43
+ };
26
44
  }
27
45
  };
28
46
  export function defineTweenComponent(engine) {
29
47
  const theComponent = Tween(engine);
30
48
  return {
31
49
  ...theComponent,
32
- Mode: TweenHelper
50
+ Mode: TweenHelper,
51
+ setMove(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
52
+ theComponent.createOrReplace(entity, {
53
+ mode: {
54
+ $case: 'move',
55
+ move: {
56
+ start,
57
+ end
58
+ }
59
+ },
60
+ duration,
61
+ easingFunction,
62
+ playing: true
63
+ });
64
+ },
65
+ setScale(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
66
+ theComponent.createOrReplace(entity, {
67
+ mode: {
68
+ $case: 'scale',
69
+ scale: {
70
+ start,
71
+ end
72
+ }
73
+ },
74
+ duration,
75
+ easingFunction,
76
+ playing: true
77
+ });
78
+ },
79
+ setRotate(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
80
+ theComponent.createOrReplace(entity, {
81
+ mode: {
82
+ $case: 'rotate',
83
+ rotate: {
84
+ start,
85
+ end
86
+ }
87
+ },
88
+ duration,
89
+ easingFunction,
90
+ playing: true
91
+ });
92
+ },
93
+ setTextureMove(entity, start, end, duration, movementType = 0 /* TextureMovementType.TMT_OFFSET */, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
94
+ theComponent.createOrReplace(entity, {
95
+ mode: {
96
+ $case: 'textureMove',
97
+ textureMove: {
98
+ start,
99
+ end,
100
+ movementType
101
+ }
102
+ },
103
+ duration,
104
+ easingFunction,
105
+ playing: true
106
+ });
107
+ },
108
+ setMoveContinuous(entity, direction, speed, duration = 0) {
109
+ theComponent.createOrReplace(entity, {
110
+ mode: {
111
+ $case: 'moveContinuous',
112
+ moveContinuous: {
113
+ direction,
114
+ speed
115
+ }
116
+ },
117
+ duration,
118
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
119
+ playing: true
120
+ });
121
+ },
122
+ setRotateContinuous(entity, direction, speed, duration = 0) {
123
+ theComponent.createOrReplace(entity, {
124
+ mode: {
125
+ $case: 'rotateContinuous',
126
+ rotateContinuous: {
127
+ direction,
128
+ speed
129
+ }
130
+ },
131
+ duration,
132
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
133
+ playing: true
134
+ });
135
+ },
136
+ setTextureMoveContinuous(entity, direction, speed, movementType = 0 /* TextureMovementType.TMT_OFFSET */, duration = 0) {
137
+ theComponent.createOrReplace(entity, {
138
+ mode: {
139
+ $case: 'textureMoveContinuous',
140
+ textureMoveContinuous: {
141
+ direction,
142
+ speed,
143
+ movementType
144
+ }
145
+ },
146
+ duration,
147
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
148
+ playing: true
149
+ });
150
+ }
33
151
  };
34
152
  }
@@ -68,6 +68,15 @@ export interface PBTween {
68
68
  } | {
69
69
  $case: "textureMove";
70
70
  textureMove: TextureMove;
71
+ } | {
72
+ $case: "rotateContinuous";
73
+ rotateContinuous: RotateContinuous;
74
+ } | {
75
+ $case: "moveContinuous";
76
+ moveContinuous: MoveContinuous;
77
+ } | {
78
+ $case: "textureMoveContinuous";
79
+ textureMoveContinuous: TextureMoveContinuous;
71
80
  } | undefined;
72
81
  /** default true (pause or running) */
73
82
  playing?: boolean | undefined;
@@ -109,6 +118,29 @@ export interface TextureMove {
109
118
  /** default = TextureMovementType.TMT_OFFSET */
110
119
  movementType?: TextureMovementType | undefined;
111
120
  }
121
+ /**
122
+ * @public
123
+ */
124
+ export interface RotateContinuous {
125
+ direction: Quaternion | undefined;
126
+ speed: number;
127
+ }
128
+ /**
129
+ * @public
130
+ */
131
+ export interface MoveContinuous {
132
+ direction: Vector3 | undefined;
133
+ speed: number;
134
+ }
135
+ /**
136
+ * @public
137
+ */
138
+ export interface TextureMoveContinuous {
139
+ direction: Vector2 | undefined;
140
+ speed: number;
141
+ /** default = TextureMovementType.TMT_OFFSET */
142
+ movementType?: TextureMovementType | undefined;
143
+ }
112
144
  /**
113
145
  * @public
114
146
  */
@@ -144,3 +176,24 @@ export declare namespace TextureMove {
144
176
  function encode(message: TextureMove, writer?: _m0.Writer): _m0.Writer;
145
177
  function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMove;
146
178
  }
179
+ /**
180
+ * @public
181
+ */
182
+ export declare namespace RotateContinuous {
183
+ function encode(message: RotateContinuous, writer?: _m0.Writer): _m0.Writer;
184
+ function decode(input: _m0.Reader | Uint8Array, length?: number): RotateContinuous;
185
+ }
186
+ /**
187
+ * @public
188
+ */
189
+ export declare namespace MoveContinuous {
190
+ function encode(message: MoveContinuous, writer?: _m0.Writer): _m0.Writer;
191
+ function decode(input: _m0.Reader | Uint8Array, length?: number): MoveContinuous;
192
+ }
193
+ /**
194
+ * @public
195
+ */
196
+ export declare namespace TextureMoveContinuous {
197
+ function encode(message: TextureMoveContinuous, writer?: _m0.Writer): _m0.Writer;
198
+ function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMoveContinuous;
199
+ }
@@ -81,6 +81,15 @@ export var PBTween;
81
81
  case "textureMove":
82
82
  TextureMove.encode(message.mode.textureMove, writer.uint32(66).fork()).ldelim();
83
83
  break;
84
+ case "rotateContinuous":
85
+ RotateContinuous.encode(message.mode.rotateContinuous, writer.uint32(74).fork()).ldelim();
86
+ break;
87
+ case "moveContinuous":
88
+ MoveContinuous.encode(message.mode.moveContinuous, writer.uint32(82).fork()).ldelim();
89
+ break;
90
+ case "textureMoveContinuous":
91
+ TextureMoveContinuous.encode(message.mode.textureMoveContinuous, writer.uint32(90).fork()).ldelim();
92
+ break;
84
93
  }
85
94
  if (message.playing !== undefined) {
86
95
  writer.uint32(48).bool(message.playing);
@@ -134,6 +143,30 @@ export var PBTween;
134
143
  }
135
144
  message.mode = { $case: "textureMove", textureMove: TextureMove.decode(reader, reader.uint32()) };
136
145
  continue;
146
+ case 9:
147
+ if (tag !== 74) {
148
+ break;
149
+ }
150
+ message.mode = {
151
+ $case: "rotateContinuous",
152
+ rotateContinuous: RotateContinuous.decode(reader, reader.uint32()),
153
+ };
154
+ continue;
155
+ case 10:
156
+ if (tag !== 82) {
157
+ break;
158
+ }
159
+ message.mode = { $case: "moveContinuous", moveContinuous: MoveContinuous.decode(reader, reader.uint32()) };
160
+ continue;
161
+ case 11:
162
+ if (tag !== 90) {
163
+ break;
164
+ }
165
+ message.mode = {
166
+ $case: "textureMoveContinuous",
167
+ textureMoveContinuous: TextureMoveContinuous.decode(reader, reader.uint32()),
168
+ };
169
+ continue;
137
170
  case 6:
138
171
  if (tag !== 48) {
139
172
  break;
@@ -362,3 +395,153 @@ export var TextureMove;
362
395
  }
363
396
  TextureMove.decode = decode;
364
397
  })(TextureMove || (TextureMove = {}));
398
+ function createBaseRotateContinuous() {
399
+ return { direction: undefined, speed: 0 };
400
+ }
401
+ /**
402
+ * @public
403
+ */
404
+ export var RotateContinuous;
405
+ (function (RotateContinuous) {
406
+ function encode(message, writer = _m0.Writer.create()) {
407
+ if (message.direction !== undefined) {
408
+ Quaternion.encode(message.direction, writer.uint32(10).fork()).ldelim();
409
+ }
410
+ if (message.speed !== 0) {
411
+ writer.uint32(21).float(message.speed);
412
+ }
413
+ return writer;
414
+ }
415
+ RotateContinuous.encode = encode;
416
+ function decode(input, length) {
417
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
418
+ let end = length === undefined ? reader.len : reader.pos + length;
419
+ const message = createBaseRotateContinuous();
420
+ while (reader.pos < end) {
421
+ const tag = reader.uint32();
422
+ switch (tag >>> 3) {
423
+ case 1:
424
+ if (tag !== 10) {
425
+ break;
426
+ }
427
+ message.direction = Quaternion.decode(reader, reader.uint32());
428
+ continue;
429
+ case 2:
430
+ if (tag !== 21) {
431
+ break;
432
+ }
433
+ message.speed = reader.float();
434
+ continue;
435
+ }
436
+ if ((tag & 7) === 4 || tag === 0) {
437
+ break;
438
+ }
439
+ reader.skipType(tag & 7);
440
+ }
441
+ return message;
442
+ }
443
+ RotateContinuous.decode = decode;
444
+ })(RotateContinuous || (RotateContinuous = {}));
445
+ function createBaseMoveContinuous() {
446
+ return { direction: undefined, speed: 0 };
447
+ }
448
+ /**
449
+ * @public
450
+ */
451
+ export var MoveContinuous;
452
+ (function (MoveContinuous) {
453
+ function encode(message, writer = _m0.Writer.create()) {
454
+ if (message.direction !== undefined) {
455
+ Vector3.encode(message.direction, writer.uint32(10).fork()).ldelim();
456
+ }
457
+ if (message.speed !== 0) {
458
+ writer.uint32(21).float(message.speed);
459
+ }
460
+ return writer;
461
+ }
462
+ MoveContinuous.encode = encode;
463
+ function decode(input, length) {
464
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
465
+ let end = length === undefined ? reader.len : reader.pos + length;
466
+ const message = createBaseMoveContinuous();
467
+ while (reader.pos < end) {
468
+ const tag = reader.uint32();
469
+ switch (tag >>> 3) {
470
+ case 1:
471
+ if (tag !== 10) {
472
+ break;
473
+ }
474
+ message.direction = Vector3.decode(reader, reader.uint32());
475
+ continue;
476
+ case 2:
477
+ if (tag !== 21) {
478
+ break;
479
+ }
480
+ message.speed = reader.float();
481
+ continue;
482
+ }
483
+ if ((tag & 7) === 4 || tag === 0) {
484
+ break;
485
+ }
486
+ reader.skipType(tag & 7);
487
+ }
488
+ return message;
489
+ }
490
+ MoveContinuous.decode = decode;
491
+ })(MoveContinuous || (MoveContinuous = {}));
492
+ function createBaseTextureMoveContinuous() {
493
+ return { direction: undefined, speed: 0, movementType: undefined };
494
+ }
495
+ /**
496
+ * @public
497
+ */
498
+ export var TextureMoveContinuous;
499
+ (function (TextureMoveContinuous) {
500
+ function encode(message, writer = _m0.Writer.create()) {
501
+ if (message.direction !== undefined) {
502
+ Vector2.encode(message.direction, writer.uint32(10).fork()).ldelim();
503
+ }
504
+ if (message.speed !== 0) {
505
+ writer.uint32(21).float(message.speed);
506
+ }
507
+ if (message.movementType !== undefined) {
508
+ writer.uint32(24).int32(message.movementType);
509
+ }
510
+ return writer;
511
+ }
512
+ TextureMoveContinuous.encode = encode;
513
+ function decode(input, length) {
514
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
515
+ let end = length === undefined ? reader.len : reader.pos + length;
516
+ const message = createBaseTextureMoveContinuous();
517
+ while (reader.pos < end) {
518
+ const tag = reader.uint32();
519
+ switch (tag >>> 3) {
520
+ case 1:
521
+ if (tag !== 10) {
522
+ break;
523
+ }
524
+ message.direction = Vector2.decode(reader, reader.uint32());
525
+ continue;
526
+ case 2:
527
+ if (tag !== 21) {
528
+ break;
529
+ }
530
+ message.speed = reader.float();
531
+ continue;
532
+ case 3:
533
+ if (tag !== 24) {
534
+ break;
535
+ }
536
+ message.movementType = reader.int32();
537
+ continue;
538
+ }
539
+ if ((tag & 7) === 4 || tag === 0) {
540
+ break;
541
+ }
542
+ reader.skipType(tag & 7);
543
+ }
544
+ return message;
545
+ }
546
+ TextureMoveContinuous.decode = decode;
547
+ })(TextureMoveContinuous || (TextureMoveContinuous = {}));
@@ -1,5 +1,6 @@
1
- import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
- import { PBTween, Move, Rotate, Scale, TextureMove } from '../generated/index.gen';
1
+ import { Entity, IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
+ import { Quaternion, Vector2, Vector3 } from '../generated/pb/decentraland/common/vectors.gen';
3
+ import { EasingFunction, Move, MoveContinuous, PBTween, Rotate, RotateContinuous, Scale, TextureMove, TextureMoveContinuous, TextureMovementType } from '../generated/index.gen';
3
4
  /**
4
5
  * @public
5
6
  */
@@ -9,17 +10,29 @@ export interface TweenHelper {
9
10
  */
10
11
  Move: (move: Move) => PBTween['mode'];
11
12
  /**
12
- * @returns a move mode tween
13
+ * @returns a move-continuous mode tween
14
+ */
15
+ MoveContinuous: (move: MoveContinuous) => PBTween['mode'];
16
+ /**
17
+ * @returns a rotate mode tween
13
18
  */
14
19
  Rotate: (rotate: Rotate) => PBTween['mode'];
15
20
  /**
16
- * @returns a move mode tween
21
+ * @returns a rotate-continuous mode tween
22
+ */
23
+ RotateContinuous: (rotate: RotateContinuous) => PBTween['mode'];
24
+ /**
25
+ * @returns a scale mode tween
17
26
  */
18
27
  Scale: (scale: Scale) => PBTween['mode'];
19
28
  /**
20
- * @returns a texture move mode tween
29
+ * @returns a texture-move mode tween
21
30
  */
22
31
  TextureMove: (textureMove: TextureMove) => PBTween['mode'];
32
+ /**
33
+ * @returns a texture-move-continuous mode tween
34
+ */
35
+ TextureMoveContinuous: (textureMove: TextureMoveContinuous) => PBTween['mode'];
23
36
  }
24
37
  /**
25
38
  * @public
@@ -29,5 +42,81 @@ export interface TweenComponentDefinitionExtended extends LastWriteWinElementSet
29
42
  * Texture helpers with constructor
30
43
  */
31
44
  Mode: TweenHelper;
45
+ /**
46
+ * @public
47
+ *
48
+ * Creates or replaces a move tween component that animates an entity's position from start to end
49
+ * @param entity - entity to apply the tween to
50
+ * @param start - starting position vector
51
+ * @param end - ending position vector
52
+ * @param duration - duration of the tween in seconds
53
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
54
+ */
55
+ setMove(entity: Entity, start: Vector3, end: Vector3, duration: number, easingFunction?: EasingFunction): void;
56
+ /**
57
+ * @public
58
+ *
59
+ * Creates or replaces a scale tween component that animates an entity's scale from start to end
60
+ * @param entity - entity to apply the tween to
61
+ * @param start - starting scale vector
62
+ * @param end - ending scale vector
63
+ * @param duration - duration of the tween in seconds
64
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
65
+ */
66
+ setScale(entity: Entity, start: Vector3, end: Vector3, duration: number, easingFunction?: EasingFunction): void;
67
+ /**
68
+ * @public
69
+ *
70
+ * Creates or replaces a rotation tween component that animates an entity's rotation from start to end
71
+ * @param entity - entity to apply the tween to
72
+ * @param start - starting rotation quaternion
73
+ * @param end - ending rotation quaternion
74
+ * @param duration - duration of the tween in seconds
75
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
76
+ */
77
+ setRotate(entity: Entity, start: Quaternion, end: Quaternion, duration: number, easingFunction?: EasingFunction): void;
78
+ /**
79
+ * @public
80
+ *
81
+ * Creates or replaces a texture move tween component that animates texture UV coordinates from start to end
82
+ * @param entity - entity to apply the tween to
83
+ * @param start - starting UV coordinates
84
+ * @param end - ending UV coordinates
85
+ * @param duration - duration of the tween in seconds
86
+ * @param movementType - type of texture movement (defaults to TMT_OFFSET)
87
+ * @param easingFunction - easing function to use (defaults to EF_LINEAR)
88
+ */
89
+ setTextureMove(entity: Entity, start: Vector2, end: Vector2, duration: number, movementType?: TextureMovementType, easingFunction?: EasingFunction): void;
90
+ /**
91
+ * @public
92
+ *
93
+ * Creates or replaces a continuous move tween component that moves an entity continuously in a direction
94
+ * @param entity - entity to apply the tween to
95
+ * @param direction - direction vector to move towards
96
+ * @param speed - speed of movement per second
97
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
98
+ */
99
+ setMoveContinuous(entity: Entity, direction: Vector3, speed: number, duration?: number): void;
100
+ /**
101
+ * @public
102
+ *
103
+ * Creates or replaces a continuous rotation tween component that rotates an entity continuously
104
+ * @param entity - entity to apply the tween to
105
+ * @param direction - rotation direction quaternion
106
+ * @param speed - speed of rotation per second
107
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
108
+ */
109
+ setRotateContinuous(entity: Entity, direction: Quaternion, speed: number, duration?: number): void;
110
+ /**
111
+ * @public
112
+ *
113
+ * Creates or replaces a continuous texture move tween component that moves texture UV coordinates continuously
114
+ * @param entity - entity to apply the tween to
115
+ * @param direction - direction vector for UV movement
116
+ * @param speed - speed of UV movement per second
117
+ * @param movementType - type of texture movement (defaults to TMT_OFFSET)
118
+ * @param duration - duration of the tween in seconds (defaults to 0 for infinite)
119
+ */
120
+ setTextureMoveContinuous(entity: Entity, direction: Vector2, speed: number, movementType?: TextureMovementType, duration?: number): void;
32
121
  }
33
122
  export declare function defineTweenComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TweenComponentDefinitionExtended;
@@ -9,12 +9,24 @@ const TweenHelper = {
9
9
  move
10
10
  };
11
11
  },
12
+ MoveContinuous(moveContinuous) {
13
+ return {
14
+ $case: 'moveContinuous',
15
+ moveContinuous
16
+ };
17
+ },
12
18
  Rotate(rotate) {
13
19
  return {
14
20
  $case: 'rotate',
15
21
  rotate
16
22
  };
17
23
  },
24
+ RotateContinuous(rotateContinuous) {
25
+ return {
26
+ $case: 'rotateContinuous',
27
+ rotateContinuous
28
+ };
29
+ },
18
30
  Scale(scale) {
19
31
  return {
20
32
  $case: 'scale',
@@ -26,13 +38,119 @@ const TweenHelper = {
26
38
  $case: 'textureMove',
27
39
  textureMove
28
40
  };
41
+ },
42
+ TextureMoveContinuous(textureMoveContinuous) {
43
+ return {
44
+ $case: 'textureMoveContinuous',
45
+ textureMoveContinuous
46
+ };
29
47
  }
30
48
  };
31
49
  function defineTweenComponent(engine) {
32
50
  const theComponent = (0, index_gen_1.Tween)(engine);
33
51
  return {
34
52
  ...theComponent,
35
- Mode: TweenHelper
53
+ Mode: TweenHelper,
54
+ setMove(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
55
+ theComponent.createOrReplace(entity, {
56
+ mode: {
57
+ $case: 'move',
58
+ move: {
59
+ start,
60
+ end
61
+ }
62
+ },
63
+ duration,
64
+ easingFunction,
65
+ playing: true
66
+ });
67
+ },
68
+ setScale(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
69
+ theComponent.createOrReplace(entity, {
70
+ mode: {
71
+ $case: 'scale',
72
+ scale: {
73
+ start,
74
+ end
75
+ }
76
+ },
77
+ duration,
78
+ easingFunction,
79
+ playing: true
80
+ });
81
+ },
82
+ setRotate(entity, start, end, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
83
+ theComponent.createOrReplace(entity, {
84
+ mode: {
85
+ $case: 'rotate',
86
+ rotate: {
87
+ start,
88
+ end
89
+ }
90
+ },
91
+ duration,
92
+ easingFunction,
93
+ playing: true
94
+ });
95
+ },
96
+ setTextureMove(entity, start, end, duration, movementType = 0 /* TextureMovementType.TMT_OFFSET */, easingFunction = 0 /* EasingFunction.EF_LINEAR */) {
97
+ theComponent.createOrReplace(entity, {
98
+ mode: {
99
+ $case: 'textureMove',
100
+ textureMove: {
101
+ start,
102
+ end,
103
+ movementType
104
+ }
105
+ },
106
+ duration,
107
+ easingFunction,
108
+ playing: true
109
+ });
110
+ },
111
+ setMoveContinuous(entity, direction, speed, duration = 0) {
112
+ theComponent.createOrReplace(entity, {
113
+ mode: {
114
+ $case: 'moveContinuous',
115
+ moveContinuous: {
116
+ direction,
117
+ speed
118
+ }
119
+ },
120
+ duration,
121
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
122
+ playing: true
123
+ });
124
+ },
125
+ setRotateContinuous(entity, direction, speed, duration = 0) {
126
+ theComponent.createOrReplace(entity, {
127
+ mode: {
128
+ $case: 'rotateContinuous',
129
+ rotateContinuous: {
130
+ direction,
131
+ speed
132
+ }
133
+ },
134
+ duration,
135
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
136
+ playing: true
137
+ });
138
+ },
139
+ setTextureMoveContinuous(entity, direction, speed, movementType = 0 /* TextureMovementType.TMT_OFFSET */, duration = 0) {
140
+ theComponent.createOrReplace(entity, {
141
+ mode: {
142
+ $case: 'textureMoveContinuous',
143
+ textureMoveContinuous: {
144
+ direction,
145
+ speed,
146
+ movementType
147
+ }
148
+ },
149
+ duration,
150
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
151
+ playing: true
152
+ });
153
+ }
36
154
  };
37
155
  }
38
156
  exports.defineTweenComponent = defineTweenComponent;
@@ -68,6 +68,15 @@ export interface PBTween {
68
68
  } | {
69
69
  $case: "textureMove";
70
70
  textureMove: TextureMove;
71
+ } | {
72
+ $case: "rotateContinuous";
73
+ rotateContinuous: RotateContinuous;
74
+ } | {
75
+ $case: "moveContinuous";
76
+ moveContinuous: MoveContinuous;
77
+ } | {
78
+ $case: "textureMoveContinuous";
79
+ textureMoveContinuous: TextureMoveContinuous;
71
80
  } | undefined;
72
81
  /** default true (pause or running) */
73
82
  playing?: boolean | undefined;
@@ -109,6 +118,29 @@ export interface TextureMove {
109
118
  /** default = TextureMovementType.TMT_OFFSET */
110
119
  movementType?: TextureMovementType | undefined;
111
120
  }
121
+ /**
122
+ * @public
123
+ */
124
+ export interface RotateContinuous {
125
+ direction: Quaternion | undefined;
126
+ speed: number;
127
+ }
128
+ /**
129
+ * @public
130
+ */
131
+ export interface MoveContinuous {
132
+ direction: Vector3 | undefined;
133
+ speed: number;
134
+ }
135
+ /**
136
+ * @public
137
+ */
138
+ export interface TextureMoveContinuous {
139
+ direction: Vector2 | undefined;
140
+ speed: number;
141
+ /** default = TextureMovementType.TMT_OFFSET */
142
+ movementType?: TextureMovementType | undefined;
143
+ }
112
144
  /**
113
145
  * @public
114
146
  */
@@ -144,3 +176,24 @@ export declare namespace TextureMove {
144
176
  function encode(message: TextureMove, writer?: _m0.Writer): _m0.Writer;
145
177
  function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMove;
146
178
  }
179
+ /**
180
+ * @public
181
+ */
182
+ export declare namespace RotateContinuous {
183
+ function encode(message: RotateContinuous, writer?: _m0.Writer): _m0.Writer;
184
+ function decode(input: _m0.Reader | Uint8Array, length?: number): RotateContinuous;
185
+ }
186
+ /**
187
+ * @public
188
+ */
189
+ export declare namespace MoveContinuous {
190
+ function encode(message: MoveContinuous, writer?: _m0.Writer): _m0.Writer;
191
+ function decode(input: _m0.Reader | Uint8Array, length?: number): MoveContinuous;
192
+ }
193
+ /**
194
+ * @public
195
+ */
196
+ export declare namespace TextureMoveContinuous {
197
+ function encode(message: TextureMoveContinuous, writer?: _m0.Writer): _m0.Writer;
198
+ function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMoveContinuous;
199
+ }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TextureMove = exports.Scale = exports.Rotate = exports.Move = exports.PBTween = exports.EasingFunction = exports.TextureMovementType = void 0;
6
+ exports.TextureMoveContinuous = exports.MoveContinuous = exports.RotateContinuous = exports.TextureMove = exports.Scale = exports.Rotate = exports.Move = exports.PBTween = exports.EasingFunction = exports.TextureMovementType = void 0;
7
7
  /* eslint-disable */
8
8
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
9
9
  const vectors_gen_1 = require("../../common/vectors.gen");
@@ -87,6 +87,15 @@ var PBTween;
87
87
  case "textureMove":
88
88
  TextureMove.encode(message.mode.textureMove, writer.uint32(66).fork()).ldelim();
89
89
  break;
90
+ case "rotateContinuous":
91
+ RotateContinuous.encode(message.mode.rotateContinuous, writer.uint32(74).fork()).ldelim();
92
+ break;
93
+ case "moveContinuous":
94
+ MoveContinuous.encode(message.mode.moveContinuous, writer.uint32(82).fork()).ldelim();
95
+ break;
96
+ case "textureMoveContinuous":
97
+ TextureMoveContinuous.encode(message.mode.textureMoveContinuous, writer.uint32(90).fork()).ldelim();
98
+ break;
90
99
  }
91
100
  if (message.playing !== undefined) {
92
101
  writer.uint32(48).bool(message.playing);
@@ -140,6 +149,30 @@ var PBTween;
140
149
  }
141
150
  message.mode = { $case: "textureMove", textureMove: TextureMove.decode(reader, reader.uint32()) };
142
151
  continue;
152
+ case 9:
153
+ if (tag !== 74) {
154
+ break;
155
+ }
156
+ message.mode = {
157
+ $case: "rotateContinuous",
158
+ rotateContinuous: RotateContinuous.decode(reader, reader.uint32()),
159
+ };
160
+ continue;
161
+ case 10:
162
+ if (tag !== 82) {
163
+ break;
164
+ }
165
+ message.mode = { $case: "moveContinuous", moveContinuous: MoveContinuous.decode(reader, reader.uint32()) };
166
+ continue;
167
+ case 11:
168
+ if (tag !== 90) {
169
+ break;
170
+ }
171
+ message.mode = {
172
+ $case: "textureMoveContinuous",
173
+ textureMoveContinuous: TextureMoveContinuous.decode(reader, reader.uint32()),
174
+ };
175
+ continue;
143
176
  case 6:
144
177
  if (tag !== 48) {
145
178
  break;
@@ -368,3 +401,153 @@ var TextureMove;
368
401
  }
369
402
  TextureMove.decode = decode;
370
403
  })(TextureMove = exports.TextureMove || (exports.TextureMove = {}));
404
+ function createBaseRotateContinuous() {
405
+ return { direction: undefined, speed: 0 };
406
+ }
407
+ /**
408
+ * @public
409
+ */
410
+ var RotateContinuous;
411
+ (function (RotateContinuous) {
412
+ function encode(message, writer = minimal_1.default.Writer.create()) {
413
+ if (message.direction !== undefined) {
414
+ vectors_gen_1.Quaternion.encode(message.direction, writer.uint32(10).fork()).ldelim();
415
+ }
416
+ if (message.speed !== 0) {
417
+ writer.uint32(21).float(message.speed);
418
+ }
419
+ return writer;
420
+ }
421
+ RotateContinuous.encode = encode;
422
+ function decode(input, length) {
423
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
424
+ let end = length === undefined ? reader.len : reader.pos + length;
425
+ const message = createBaseRotateContinuous();
426
+ while (reader.pos < end) {
427
+ const tag = reader.uint32();
428
+ switch (tag >>> 3) {
429
+ case 1:
430
+ if (tag !== 10) {
431
+ break;
432
+ }
433
+ message.direction = vectors_gen_1.Quaternion.decode(reader, reader.uint32());
434
+ continue;
435
+ case 2:
436
+ if (tag !== 21) {
437
+ break;
438
+ }
439
+ message.speed = reader.float();
440
+ continue;
441
+ }
442
+ if ((tag & 7) === 4 || tag === 0) {
443
+ break;
444
+ }
445
+ reader.skipType(tag & 7);
446
+ }
447
+ return message;
448
+ }
449
+ RotateContinuous.decode = decode;
450
+ })(RotateContinuous = exports.RotateContinuous || (exports.RotateContinuous = {}));
451
+ function createBaseMoveContinuous() {
452
+ return { direction: undefined, speed: 0 };
453
+ }
454
+ /**
455
+ * @public
456
+ */
457
+ var MoveContinuous;
458
+ (function (MoveContinuous) {
459
+ function encode(message, writer = minimal_1.default.Writer.create()) {
460
+ if (message.direction !== undefined) {
461
+ vectors_gen_1.Vector3.encode(message.direction, writer.uint32(10).fork()).ldelim();
462
+ }
463
+ if (message.speed !== 0) {
464
+ writer.uint32(21).float(message.speed);
465
+ }
466
+ return writer;
467
+ }
468
+ MoveContinuous.encode = encode;
469
+ function decode(input, length) {
470
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
471
+ let end = length === undefined ? reader.len : reader.pos + length;
472
+ const message = createBaseMoveContinuous();
473
+ while (reader.pos < end) {
474
+ const tag = reader.uint32();
475
+ switch (tag >>> 3) {
476
+ case 1:
477
+ if (tag !== 10) {
478
+ break;
479
+ }
480
+ message.direction = vectors_gen_1.Vector3.decode(reader, reader.uint32());
481
+ continue;
482
+ case 2:
483
+ if (tag !== 21) {
484
+ break;
485
+ }
486
+ message.speed = reader.float();
487
+ continue;
488
+ }
489
+ if ((tag & 7) === 4 || tag === 0) {
490
+ break;
491
+ }
492
+ reader.skipType(tag & 7);
493
+ }
494
+ return message;
495
+ }
496
+ MoveContinuous.decode = decode;
497
+ })(MoveContinuous = exports.MoveContinuous || (exports.MoveContinuous = {}));
498
+ function createBaseTextureMoveContinuous() {
499
+ return { direction: undefined, speed: 0, movementType: undefined };
500
+ }
501
+ /**
502
+ * @public
503
+ */
504
+ var TextureMoveContinuous;
505
+ (function (TextureMoveContinuous) {
506
+ function encode(message, writer = minimal_1.default.Writer.create()) {
507
+ if (message.direction !== undefined) {
508
+ vectors_gen_1.Vector2.encode(message.direction, writer.uint32(10).fork()).ldelim();
509
+ }
510
+ if (message.speed !== 0) {
511
+ writer.uint32(21).float(message.speed);
512
+ }
513
+ if (message.movementType !== undefined) {
514
+ writer.uint32(24).int32(message.movementType);
515
+ }
516
+ return writer;
517
+ }
518
+ TextureMoveContinuous.encode = encode;
519
+ function decode(input, length) {
520
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
521
+ let end = length === undefined ? reader.len : reader.pos + length;
522
+ const message = createBaseTextureMoveContinuous();
523
+ while (reader.pos < end) {
524
+ const tag = reader.uint32();
525
+ switch (tag >>> 3) {
526
+ case 1:
527
+ if (tag !== 10) {
528
+ break;
529
+ }
530
+ message.direction = vectors_gen_1.Vector2.decode(reader, reader.uint32());
531
+ continue;
532
+ case 2:
533
+ if (tag !== 21) {
534
+ break;
535
+ }
536
+ message.speed = reader.float();
537
+ continue;
538
+ case 3:
539
+ if (tag !== 24) {
540
+ break;
541
+ }
542
+ message.movementType = reader.int32();
543
+ continue;
544
+ }
545
+ if ((tag & 7) === 4 || tag === 0) {
546
+ break;
547
+ }
548
+ reader.skipType(tag & 7);
549
+ }
550
+ return message;
551
+ }
552
+ TextureMoveContinuous.decode = decode;
553
+ })(TextureMoveContinuous = exports.TextureMoveContinuous || (exports.TextureMoveContinuous = {}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.10.5",
4
+ "version": "7.10.6-18360040798.commit-8d5d559",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -33,5 +33,5 @@
33
33
  },
34
34
  "types": "./dist/index.d.ts",
35
35
  "typings": "./dist/index.d.ts",
36
- "commit": "e0bb8d6f8ff5e9b69ba25bf8309a0b36a7f48d61"
36
+ "commit": "8d5d5591584187301bc3522264432b3e7d7ab38f"
37
37
  }