You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
dalisoft edited this page Aug 4, 2017
·
2 revisions
Event / Emit Event
There are 3 type of event listener method and 1 call event method.
importTWEEN,{Tween,Easing,Interpolation}from'es6-tween';constt=newTween({x : 0}).to({x : 100},2000).start();// Event "on" examplet.on('update',({ x })=>{console.log(`The current x value is ${x}`);});// Event "once" examplet.once('update',({ x })=>{console.log('The update callback was called once');});// Event "off" examplet.off('update');// `on('update', ...)` was deleted and not anymore was call// Custom event and emit callingt.on('xReach50',({ x })=>{console.log('Hooray! ','The { x } was calling from half-start');});t.on('update',({ x })=>{if(x>=50){t.emit('xReach50',{ x -50});}});