cbs-dsp-frontpage/assets/js/tsneko.js

1 line
8.0 KiB
JavaScript
Raw Normal View History

2021-06-25 11:39:57 +09:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.tsneko=e():t.tsneko=e()}(this,(function(){return function(){"use strict";var t={607:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){void 0===i&&(i=s),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[s]}})}:function(t,e,s,i){void 0===i&&(i=s),t[i]=e[s]}),r=this&&this.__exportStar||function(t,e){for(var s in t)"default"===s||Object.prototype.hasOwnProperty.call(e,s)||i(e,t,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.runWebDefault=e.runWeb=void 0,r(s(441),e);var n=s(339);Object.defineProperty(e,"runWeb",{enumerable:!0,get:function(){return n.run}}),Object.defineProperty(e,"runWebDefault",{enumerable:!0,get:function(){return n.runDefault}})},441:function(t,e){var s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var e,s=1,i=arguments.length;s<i;s++)for(var r in e=arguments[s])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.Neko=e.defaultNeko=e.defaultConfig=void 0;var i=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};e.defaultConfig={speed:10,radius:10,ticksBeforeItch:function(){return i(7,14)},ticksBeforeScratch:function(){return i(7,14)},ticksBeforeYawn:function(){return i(20,40)},scratchDirection:function(){return{1:"s",2:"w",3:"e",4:"n"}[Math.floor(4*Math.random())+1]}},e.defaultNeko=function(){return new r(e.defaultConfig)};var r=function(){function t(t){var e=this;this.state={name:"still",x:0,y:0,ticksBeforeItch:5,ticksBeforeScratch:5,ticksBeforeYawn:10},this.update=function(t,s){"still"==e.state.name?e.updateStill(t,s):"itch"==e.state.name?e.updateItch(t,s):"alert"==e.state.name?e.updateAlert(t,s):"run"==e.state.name?e.updateRun(t,s):"scratch"==e.state.name?e.updateScratch(t,s):"yawn"==e.state.name?e.updateYawn(t,s):"sleep"==e.state.name&&e.updateSleep(t,s)},this.config=s({},t),this.state.ticksBeforeItch=t.ticksBeforeItch(),this.state.ticksBeforeScratch=t.ticksBeforeScratch(),this.state.ticksBeforeYawn=t.ticksBeforeYawn()}return Object.defineProperty(t.prototype,"img",{get:function(){return""+(this.state.direction?this.state.direction:"")+this.state.name+(this.state.tick?this.state.tick:"")},enumerable:!1,configurable:!0}),t.prototype.updateSleep=function(t,e){if(this.checkState("sleep"),!this.cursorClose(t,e))return this.state.name="alert",this.state.tick=null,this.state.ticksBeforeItch=this.config.ticksBeforeItch(),void(this.state.ticksBeforeScratch=this.config.ticksBeforeScratch());this.state.tick=1===this.state.tick?2:1},t.prototype.updateYawn=function(t,e){if(this.checkState("yawn"),!this.cursorClose(t,e))return this.state.name="alert",void(this.state.framesYawn=null);this.state.framesYawn-1==0&&(this.state.name="sleep",this.state.tick=1,this.state.framesYawn=null,this.state.ticksBeforeYawn=this.config.ticksBeforeYawn()),this.state.framesYawn-=1},t.prototype.updateScratch=function(t,e){return this.checkState("scratch"),this.cursorClose(t,e)?this.state.framesScratch-1==0?(this.state.name="still",this.state.tick=null,this.state.framesScratch=null,this.state.ticksBeforeScratch=this.config.ticksBeforeScratch(),void(this.state.direction=null)):(this.state.framesScratch-=1,void(this.state.tick=1===this.state.tick?2:1)):(this.state.name="alert",this.state.tick=null,this.state.framesScratch=null,this.state.ticksBeforeScratch=this.config.ticksBeforeScratch(),void(this.state.direction=null))},t.prototype.updateStill=function(t,e){return this.checkState("still"),this.cursorClose(t,e)||(this.state.name="alert",this.state.tick=null),0===this.state.ticksBeforeYawn?(this.state.name="yawn",void(this.state.framesYawn=2)):0===this.state.ticksBeforeItch?(this.state.name="itch",this.state.framesItch=4,void(this.state.tick=1)):0===this.state.ticksBeforeScratch?(this.state.name="scratch",this.state.framesScratch=4,this.state.tick=1,void(this.state.direction=this.config.scratchDirectio