xxxxxxxxxx
1
var p5;!function(t){!function(t){t.EASINGS={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1- --t*t*t*t,easeInOutQuart:t=>t<.5?8*t*t*t*t:1-8*--t*t*t*t,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1+--t*t*t*t*t,easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t,easeInElastic:t=>(.04-.04/t)*Math.sin(25*t)+1,easeOutElastic:t=>.04*t/--t*Math.sin(25*t),easeInOutElastic:t=>(t-=.5)<0?(.02+.01/t)*Math.sin(50*t):(.02-.01/t)*Math.sin(50*t)+1,easeInSin:t=>1+Math.sin(Math.PI/2*t-Math.PI/2),easeOutSin:t=>Math.sin(Math.PI/2*t),easeInOutSin:t=>(1+Math.sin(Math.PI*t-Math.PI/2))/2}}(t.tween||(t.tween={}))}(p5||(p5={})),function(t){!function(t){t.Tween=class{constructor(t){this.motions=[],this.keyChanges=[],this.active=!1,this.isLoop=!1,this.isPaused=!1,this.currentMotionIndex=0,this.obj=t}resetToStart(){for(let t in this.start)this.obj[t]=this.start[t];this.motionStart=this.createStartObject(this.start)}createStartObject(t){const e={};return this.keyChanges.forEach(i=>e[i]=t[i]),e}addToKeyChangeList(t){this.keyChanges.includes(t)||this.keyChanges.push(t)}interpolation(e,i,s,n="linear"){return(n in t.EASINGS?t.EASINGS[n]:t.EASINGS.linear)(s)*(i-e)+e}addMotion(t,e,i,s="linear"){return this.addToKeyChangeList(t),this.motions.push({actions:[{key:t,target:e}],duration:i,leftTime:0,easing:s}),this}addMotions(t,e,i="linear"){return t.flatMap(t=>t.key).forEach(t=>this.addToKeyChangeList(t)),this.motions.push({actions:t,duration:e,leftTime:0,easing:i}),this}resetMotions(){this.motions=[]}startLoop(){return this.isLoop=!0,this.startTween(),this}startTween(){return this.start=this.createStartObject(this.obj),this.motionStart=this.createStartObject(this.obj),this.currentMotionIndex=0,this.active=!0,this}pause(){return this.isPaused=!0,this}resume(){return this.isPaused=!1,this}restart(){return this.pause(),this.currentMotionIndex=0,this.motions.forEach(t=>t.leftTime=0),this.resetToStart(),this.resume(),this}update(t){if(!this.active||this.isPaused)return;const e=this.motions[this.currentMotionIndex];if(e.leftTime>=e.duration&&(e.leftTime=0,this.motionStart=this.createStartObject(this.obj),this.currentMotionIndex+=1,this.currentMotionIndex>=this.motions.length&&(this.isLoop?(this.resetToStart(),this.currentMotionIndex=0):this.active=!1)),e.leftTime+=t,e.actions)for(let t of e.actions)if(t.key&&!isNaN(t.target)){const i=Math.min(e.leftTime/e.duration,1);this.obj[t.key]=this.interpolation(this.motionStart[t.key],t.target,i,e.easing)}}}}(t.tween||(t.tween={}))}(p5||(p5={})),function(t){!function(t){t.GeometricObjectTween=class extends t.Tween{addMotionTo(t,e,i="linear"){let s=[];t.x&&s.push({key:"x",target:t.x}),t.y&&s.push({key:"y",target:t.y}),t.width&&s.push({key:"width",target:t.width}),t.height&&s.push({key:"height",target:t.height}),t.w&&s.push({key:"w",target:t.w}),t.h&&s.push({key:"h",target:t.h}),t.angle&&s.push({key:"angle",target:t.angle}),t.rotation&&s.push({key:"rotation",target:t.rotation}),super.addMotions(s,e,i)}}}(t.tween||(t.tween={}))}(p5||(p5={})),function(t){!function(e){e.manager=new class{constructor(){this.tweens=[]}getTween(t){return this.tweens.find(e=>e.name===t).tween}addTween(t,i){const s=i||"tween"+this.tweens.length,n=new e.Tween(t);return this.tweens.push({name:s,tween:n}),n}update(t){for(let e of this.tweens)e.tween.update(t)}},t.prototype.registerMethod("pre",()=>e.manager.update(window.deltaTime))}(t.tween||(t.tween={}))}(p5||(p5={}));