@@ -15,9 +15,15 @@ <h2>10 _ yoyo</h2>
1515 < div id ="target1 " data-rotation ="0 " data-y ="0 " class ="box " style ="left: 0px; top: 0px ">
1616 yoyo with repeat once
1717 </ div >
18- < div id ="target2 " data-rotation ="0 " data-y ="0 " class ="box " style ="left: 300px ; top: 0px ">
18+ < div id ="target2 " data-rotation ="0 " data-y ="0 " class ="box " style ="left: 200px ; top: 0px ">
1919 yoyo with repeat forever
2020 </ div >
21+ < div id ="target3 " data-rotation ="0 " data-y ="0 " class ="box " style ="left: 400px; top: 0px ">
22+ yoyo with repeat once, relative values
23+ </ div >
24+ < div id ="target4 " data-rotation ="0 " data-y ="0 " class ="box " style ="left: 600px; top: 0px ">
25+ yoyo with repeat forever, relative values
26+ </ div >
2127 </ div >
2228
2329 < script src ="../dist/tween.umd.js "> </ script >
@@ -50,6 +56,28 @@ <h2>10 _ yoyo</h2>
5056 updateBox ( target2 , object ) ;
5157 } )
5258 . start ( ) ;
59+ target3 = document . getElementById ( 'target3' ) ,
60+ tween3 = new TWEEN . Tween ( target3 . dataset )
61+ . to ( { rotation : "+360" , y :"+300" } , 750 )
62+ . repeat ( 1 )
63+ . delay ( 1000 )
64+ . yoyo ( true )
65+ . easing ( TWEEN . Easing . Cubic . InOut )
66+ . onUpdate ( function ( object ) {
67+ updateBox ( target3 , object ) ;
68+ } )
69+ . start ( ) ;
70+ target4 = document . getElementById ( 'target4' ) ,
71+ tween4 = new TWEEN . Tween ( target4 . dataset )
72+ . to ( { rotation : "+360" , y :"+300" } , 750 )
73+ . repeat ( Infinity )
74+ . delay ( 1000 )
75+ . yoyo ( true )
76+ . easing ( TWEEN . Easing . Cubic . InOut )
77+ . onUpdate ( function ( object ) {
78+ updateBox ( target4 , object ) ;
79+ } )
80+ . start ( ) ;
5381 }
5482
5583 function animate ( time ) {
@@ -94,6 +122,12 @@ <h2>10 _ yoyo</h2>
94122 # target2 {
95123 background : # cfc ;
96124 }
125+ # target3 {
126+ background : deeppink;
127+ }
128+ # target4 {
129+ background : cyan;
130+ }
97131 </ style >
98132 </ body >
99133</ html >
0 commit comments