Skip to content

Commit c4c09c0

Browse files
authored
feat: continuous tween test scene (#35)
1 parent bcd333d commit c4c09c0

17 files changed

Lines changed: 276 additions & 119 deletions

File tree

dcl-workspace.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
{
2828
"path": "scenes/77,-5-tweens-moving-platforms"
2929
},
30+
{
31+
"path": "scenes/77,-4-continuous-tween"
32+
},
3033
{
3134
"path": "scenes/77,-1-raycast-unit-tests"
3235
},

scenes/0,3-texture-movement/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
},
1212
"devDependencies": {
1313
"@dcl/asset-packs": "^1.20.0",
14-
"@dcl/js-runtime": "7.6.3",
15-
"@dcl/sdk": "latest"
14+
"@dcl/js-runtime": "7.10.6-18360453790.commit-2ff55cb",
15+
"@dcl/sdk": "^7.10.6-18360453790.commit-2ff55cb"
1616
},
1717
"engines": {
1818
"node": ">=16.0.0",

scenes/0,3-texture-movement/src/utils.ts

Lines changed: 73 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,14 @@ export function createCube(
5353

5454
MeshCollider.setBox(boxEntity)
5555

56-
Tween.create(boxEntity, {
57-
duration: tweenDuration,
58-
easingFunction: easingFunction,
59-
currentTime: 0,
60-
playing: true,
61-
mode: Tween.Mode.TextureMove({
62-
start: textureMoveStart,
63-
end: textureMoveTarget,
64-
movementType: movementType
65-
})
66-
})
56+
Tween.setTextureMove(
57+
boxEntity,
58+
textureMoveStart,
59+
textureMoveTarget,
60+
tweenDuration,
61+
movementType,
62+
easingFunction
63+
)
6764

6865
TweenSequence.create(boxEntity, { sequence: [], loop: sequenceLoop })
6966
}
@@ -156,87 +153,76 @@ export function createTilingPlane() {
156153
})
157154
})
158155

159-
Tween.create(plane, {
160-
duration: 4000,
161-
easingFunction: EasingFunction.EF_LINEAR,
162-
currentTime: 0,
163-
playing: true,
164-
mode: Tween.Mode.TextureMove({
165-
start: Vector2.create(1, 1),
166-
end: Vector2.create(2, 2),
167-
movementType: TextureMovementType.TMT_TILING
168-
})
169-
})
156+
Tween.setTextureMove(
157+
plane,
158+
Vector2.create(1, 1),
159+
Vector2.create(2, 2),
160+
4000,
161+
TextureMovementType.TMT_TILING
162+
)
170163

171164
TweenSequence.create(plane, { sequence: [], loop: TweenLoop.TL_YOYO })
172165
}
173166

174167

175168
export function createVerifyOtherTweens(){
169+
const sign = engine.addEntity()
170+
171+
Transform.create(sign, {
172+
position: Vector3.create(8, 4, 10),
173+
})
174+
175+
TextShape.create(sign, {
176+
text: "Rotation, Move and Scale tweens\nto verify all tweens work",
177+
fontSize: 8,
178+
outlineWidth: .2,
179+
outlineColor: Color4.Black()
180+
})
181+
182+
Billboard.create(sign, {billboardMode: BillboardMode.BM_Y})
183+
184+
const myEntity = engine.addEntity()
185+
Transform.create(myEntity, {
186+
position: Vector3.create(2, 1.2, 10),
187+
})
188+
MeshRenderer.setBox(myEntity)
189+
190+
Tween.setRotate(
191+
myEntity,
192+
Quaternion.fromEulerDegrees(0, 0, 0),
193+
Quaternion.fromEulerDegrees(0, 170, 0),
194+
700
195+
)
196+
197+
TweenSequence.create(myEntity, { sequence: [], loop: TweenLoop.TL_YOYO })
198+
199+
const myEntity2 = engine.addEntity()
200+
Transform.create(myEntity2, {
201+
position: Vector3.create(6, 1.2, 10),
202+
})
203+
MeshRenderer.setBox(myEntity2)
204+
205+
Tween.setMove(
206+
myEntity2,
207+
Vector3.create(6, 1.2, 10),
208+
Vector3.create(7, 2, 11),
209+
700
210+
)
211+
212+
TweenSequence.create(myEntity2, { sequence: [], loop: TweenLoop.TL_YOYO })
213+
214+
const myEntity3 = engine.addEntity()
215+
Transform.create(myEntity3, {
216+
position: Vector3.create(12, 1.2, 10),
217+
})
218+
MeshRenderer.setBox(myEntity3)
219+
220+
Tween.setScale(
221+
myEntity3,
222+
Vector3.create(1, 1, 1),
223+
Vector3.create(2, 3, 4),
224+
700
225+
)
176226

177-
const sign = engine.addEntity()
178-
179-
Transform.create(sign, {
180-
position: Vector3.create(8, 4, 10),
181-
})
182-
183-
TextShape.create(sign, {
184-
text: "Rotation, Move and Scale tweens\nto verify all tweens work",
185-
fontSize: 8,
186-
outlineWidth: .2,
187-
outlineColor: Color4.Black()
188-
})
189-
190-
Billboard.create(sign, {billboardMode: BillboardMode.BM_Y})
191-
192-
const myEntity = engine.addEntity()
193-
Transform.create(myEntity, {
194-
position: Vector3.create(2, 1.2, 10),
195-
})
196-
MeshRenderer.setBox(myEntity)
197-
198-
Tween.create(myEntity, {
199-
mode: Tween.Mode.Rotate({
200-
start: Quaternion.fromEulerDegrees(0, 0, 0),
201-
end: Quaternion.fromEulerDegrees(0, 170, 0),
202-
}),
203-
duration: 700,
204-
easingFunction: EasingFunction.EF_LINEAR,
205-
})
206-
207-
TweenSequence.create(myEntity, { sequence: [], loop: TweenLoop.TL_YOYO })
208-
209-
const myEntity2 = engine.addEntity()
210-
Transform.create(myEntity2, {
211-
position: Vector3.create(6, 1.2, 10),
212-
})
213-
MeshRenderer.setBox(myEntity2)
214-
215-
Tween.create(myEntity2, {
216-
mode: Tween.Mode.Move({
217-
start: Vector3.create(6, 1.2, 10),
218-
end: Vector3.create(7, 2, 11),
219-
}),
220-
duration: 700,
221-
easingFunction: EasingFunction.EF_LINEAR,
222-
})
223-
224-
TweenSequence.create(myEntity2, { sequence: [], loop: TweenLoop.TL_YOYO })
225-
226-
const myEntity3 = engine.addEntity()
227-
Transform.create(myEntity3, {
228-
position: Vector3.create(12, 1.2, 10),
229-
})
230-
MeshRenderer.setBox(myEntity3)
231-
232-
Tween.create(myEntity3, {
233-
mode: Tween.Mode.Scale({
234-
start: Vector3.create(1, 1, 1),
235-
end: Vector3.create(2, 3, 4),
236-
}),
237-
duration: 700,
238-
easingFunction: EasingFunction.EF_LINEAR,
239-
})
240-
241-
TweenSequence.create(myEntity3, { sequence: [], loop: TweenLoop.TL_YOYO })
227+
TweenSequence.create(myEntity3, { sequence: [], loop: TweenLoop.TL_YOYO })
242228
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.*
2+
package.json
3+
package-lock.json
4+
yarn-lock.json
5+
build.json
6+
export
7+
tsconfig.json
8+
tslint.json
9+
node_modules
10+
*.ts
11+
*.tsx
12+
Dockerfile
13+
dist
14+
screenshots
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package-lock.json
2+
node_modules
3+
bin
4+
*.swp
5+
*.*~
6+
export
7+
.idea/

scenes/77,-4-continuous-tween/README.md

Whitespace-only changes.
15.7 KB
Binary file not shown.
76.1 KB
Loading
83.6 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "continuous-tween",
3+
"description": "Continuous Tween",
4+
"version": "1.0.0",
5+
"dependencies": {
6+
"@dcl-sdk/utils": "latest",
7+
"@dcl/sdk": "^7.10.6-18360453790.commit-2ff55cb",
8+
"@dcl/js-runtime": "7.10.6-18360453790.commit-2ff55cb"
9+
},
10+
"scripts": {
11+
"build": "sdk-commands build --skip-install",
12+
"deploy": "sdk-commands deploy",
13+
"start": "sdk-commands start"
14+
}
15+
}

0 commit comments

Comments
 (0)