@@ -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
175168export 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}
0 commit comments