Skip to content

Instantly share code, notes, and snippets.

@hakatashi
Created June 22, 2014 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakatashi/69cdf750145c539634ce to your computer and use it in GitHub Desktop.
Save hakatashi/69cdf750145c539634ce to your computer and use it in GitHub Desktop.
var YouTyping=function(){function こころ(こころ){var いつも=new Date,ぴょん=ぴょ(いつも.getHours(),2),ぴょんと=ぴょ(いつも.getMinutes(),2),ぴょーん=ぴょ(いつも.getSeconds(),2),こころぴょん=ぴょ(いつも.getMilliseconds(),3);$("#debug").append("["+ぴょん+":"+ぴょんと+":"+ぴょーん+"."+こころぴょん+"] "+こころ+"\n"),console.log(こころ)}function いつも(こころ){こころ=こころ.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var いつも=new RegExp("[\\?&]"+こころ+"=([^&#]*)"),ぴょ=いつも.exec(location.search);return null===ぴょ?"":decodeURIComponent(ぴょ[1].replace(/\+/g," "))}function ぴょ(こころ,いつも){return こころ=こころ.toString(),こころ.length<いつも?ぴょ("0"+こころ,いつも):こころ}var ぴょん=function(ぴょ,ぴょん){var ぴょーん=this;this.noteState={WAITING:0,HITTING:1,CLEARED:2,HITTINGFAILED:3,FAILED:4};var いつもぴょん,ぴょぴょん=function(){いつもぴょん=$.Deferred(),こころ("Setting Player Up...");var いつも=document.createElement("script");いつも.src="https://www.youtube.com/iframe_api";var ぴょ=document.getElementsByTagName("script")[0];return ぴょ.parentNode.insertBefore(いつも,ぴょ),いつもぴょん.promise()};window.onYouTubeIframeAPIReady=function(){var ぴょ=ぴょーん.settings;こころ("Player API is Ready."),"true"===いつも("sandbox")&&this.DOM.player.setAttribute("sandbox","allow-same-origin allow-scripts"),ぴょーん.player=new YT.Player("youtyping-player",{height:ぴょ.height,width:ぴょ.width,videoId:ぴょ.videoId,playerVars:{rel:0,start:ぴょ.offset,controls:0,showinfo:0,modestbranding:1,wmode:"opaque"},events:{onReady:ぴょーんぴょん,onStateChange:こころぴょんと,onError:いつもぴょんと}})};var ぴょんぴょん,ぴょんとぴょん,ぴょーんぴょん=function(){こころ("Player is Ready."),ぴょーん.player.setVolume(ぴょーん.settings.volume),ぴょーん.player.setPlaybackQuality(ぴょーん.settings.playbackQuality),いつもぴょん.resolve()},こころぴょんと=function(いつも){switch(ぴょんぴょーん.onPlayerStateChange&&ぴょんぴょーん.onPlayerStateChange.call(ぴょんぴょーん,いつも),いつも.data){case YT.PlayerState.ENDED:こころ("Player Ended.");break;case YT.PlayerState.PLAYING:こころ("Player Started.");break;case YT.PlayerState.PAUSED:こころ("Player Paused.");break;case YT.PlayerState.BUFFERING:こころ("Player Buffering.");break;case YT.PlayerState.CUED:こころ("Player Cued.")}},いつもぴょんと=function(いつも){switch(いつも.data){case 2:こころ("ERROR: The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.");break;case 5:こころ("ERROR: The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.");break;case 100:こころ("ERROR: The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.");break;case 101:こころ("ERROR: The owner of the requested video does not allow it to be played in embedded players.");break;case 150:こころ("ERROR: The owner of the requested video does not allow it to be played in embedded players.")}いつもぴょん.reject()},ぴょぴょんと=function(){return ぴょんぴょん=$.Deferred(),$.ajax({url:ぴょーん.settings.dataFile,type:"get",datatype:"xml",timeout:1e3,success:function(いつも){ぴょーん.dataXML=$(いつも).find("data").first();var ぴょ=ぴょーん.dataXML.find("roll > item");ぴょーん.roll=[],$(ぴょ).each(function(){var こころ={time:1e3*parseFloat($(this).attr("time")),type:$(this).attr("type")};$(this).has("text")&&(こころ.text=こころ.remainingText=$(this).children("text").text()),"note"===こころ.type&&(こころ.state=ぴょーん.noteState.WAITING),ぴょーん.roll.push(こころ)}),ぴょーん.nextLyricIndex=ぴょーんぴょんと(-1),こころ("Loaded XML File."),ぴょんぴょん.resolve()},error:function(いつも,ぴょ,ぴょん){こころ("ERROR: XML File Loading Failed: "+ぴょん),ぴょんぴょん.reject()}}),ぴょんぴょん.promise()},ぴょんぴょんと=function(){return ぴょんとぴょん=$.Deferred(),$.ajax({url:ぴょーん.settings.tableFile,type:"get",datatype:"xml",timeout:1e3,success:function(いつも){try{ぴょーん.table=[],$(いつも).find("table").find("rule").each(function(こころ){if(ぴょーん.table.push({before:$(this).attr("before"),after:$(this).attr("after"),next:$(this).attr("next")}),$(this).attr("next")&&1!==$(this).attr("next").length)throw"Rule "+こころ+": next string must be one character"}),こころ("Loaded Table File."),ぴょんとぴょん.resolve()}catch(ぴょ){こころ("ERROR: Table File Parsing Failed: "+ぴょ),ぴょんとぴょん.reject()}},error:function(いつも,ぴょ,ぴょん){こころ("ERROR: Table File Loading Failed: "+ぴょん),ぴょんとぴょん.reject()}}),ぴょんとぴょん.promise()},ぴょんとぴょんと=function(こころ){for(var いつも=null,ぴょ=こころ+1;ぴょ<ぴょーん.roll.length;ぴょ++){var ぴょん=ぴょーん.roll[ぴょ];if("stop"===ぴょん.type){いつも=null;break}if("note"===ぴょん.type){いつも=ぴょ;break}}return いつも},ぴょーんぴょんと=function(こころ){for(var いつも=null,ぴょ=こころ+1;ぴょ<ぴょーん.roll.length;ぴょ++){var ぴょん=ぴょーん.roll[ぴょ];if("lyric"===ぴょん.type){いつも=ぴょ;break}}return いつも},こころぴょーん=function(){var こころ=ぴょーん.player.getCurrentTime(),いつも=ぴょーん.now;if(こころ===ぴょーん.settings.offset)ぴょーん.zeroTimePad=いつも-1e3*ぴょーん.settings.offset+ぴょーん.correction,ぴょーん.zeroTime=いつも-1e3*ぴょーん.settings.offset+ぴょーん.correction;else if(ぴょーん.currentTime!==こころ&&こころ>ぴょーん.settings.offset){ぴょーん.currentTime=こころ,ぴょーん.estimatedZero=いつも-1e3*ぴょーん.currentTime,ぴょーん.estimateSamples.push(ぴょーん.estimatedZero),ぴょーん.estimateSamples.length>ぴょーん.settings.zeroEstimateSamples&&ぴょーん.estimateSamples.shift();var ぴょ=ぴょーん.estimateSamples.reduce(function(こころ,いつも){return こころ+いつも});ぴょーん.zeroTimePad=ぴょ/ぴょーん.estimateSamples.length+ぴょーん.correction,ぴょーん.zeroCallFPS++}ぴょーん.zeroTime=.9*(ぴょーん.zeroTime-ぴょーん.zeroTimePad)+ぴょーん.zeroTimePad;var ぴょん=いつも-ぴょーん.zeroTime,ぴょんと=null,こころぴょん=null;ぴょーん.roll.forEach(function(こころ,いつも){"note"===こころ.type&&こころ.time+ぴょーん.settings.failureSuspension<ぴょん?(こころ.state===ぴょーん.noteState.WAITING||こころ.state===ぴょーん.noteState.HITTING)&&(ぴょんと&&(いつもぴょーん(ぴょんと),こころぴょん===ぴょーん.currentNoteIndex&&(ぴょーん.currentNoteIndex=null,ぴょーん.inputBuffer="")),ぴょんと=こころ,こころぴょん=いつも):"lyric"===こころ.type&&こころ.time<ぴょん?ぴょーん.currentLyricIndex<いつも&&(ぴょーん.currentLyricIndex=いつも,ぴょーん.nextLyricIndex=ぴょーんぴょんと(いつも)):"stop"===こころ.type&&こころ.time<ぴょん&&(ぴょーん.currentLyricIndex<いつも&&(ぴょーん.currentLyricIndex=null),ぴょんと&&(いつもぴょーん(ぴょんと),こころぴょん===ぴょーん.currentNoteIndex&&(ぴょーん.currentNoteIndex=null,ぴょーん.inputBuffer="")),ぴょんと=null,こころぴょん=null)})},いつもぴょーん=function(こころ){こころ.state===ぴょーん.noteState.WAITING?こころ.state=ぴょーん.noteState.FAILED:こころ.state===ぴょーん.noteState.HITTING&&(こころ.state=ぴょーん.noteState.HITTINGFAILED),ぴょーん.combo=0};this.startTime=Date.now(),this.dataXML=null,this.roll=null,this.player=null,this.settings={zeroEstimateSamples:16,videoId:"fQ_m5VLhqNg",dataFile:"data.utx",width:1120,height:630,hitPosition:.4,noteSize:50,speed:.5,rollYpos:.5,longLineHeight:150,lineHeight:120,screenPadding:30,bufferTextPosition:[.2,.8],currentLyricPosition:[.5,.25],nextLyricPosition:[.5,.3],kanaLyricPosition:[.5,.8],judges:[{name:"perfect",from:-50,to:50},{name:"great",from:-70,to:70},{name:"good",from:-100,to:100},{name:"bad",from:-1/0,to:150}],breakCombo:"bad",failureSuspension:100,correction:0,controlledCorrection:0,offset:0,volume:100,playbackQuality:"default",tableFile:"convert/romaji.xml"},this.zeroTime=0,this.zeroTimePad=0,this.currentTime=0,this.estimateSamples=[],this.estimatedZero=0,this.zeroCallFPS=0,Object.defineProperty(this,"now",{get:function(){return window.performance.now()}}),this.table=[],this.currentNoteIndex=null,this.inputBuffer="",this.currentLyricIndex=null,this.nextLyricIndex=null,this.combo=0,this.play=function(){ぴょーん.player.playVideo(),setInterval(こころぴょーん,10)},this.hit=function(こころ,いつも,ぴょ){いつも||(いつも=ぴょーん.now-ぴょーん.zeroTime);var ぴょん=function(いつも,ぴょ){var ぴょんと=ぴょーん.roll[いつも],いつもぴょん="";いつもぴょん=いつも===ぴょーん.currentNoteIndex?ぴょーん.inputBuffer+こころ:こころ,ぴょ||(ぴょ=こころ);var ぴょぴょん=ぴょーん.table.filter(function(こころ){if(!こころぴょん(こころ.before,いつもぴょん))return!1;if(!こころぴょん(ぴょんと.remainingText,こころ.after))return!1;if(こころ.next){var ぴょ;if(null!==(ぴょ=ぴょんとぴょんと(いつも))){var ぴょーん=ぴょん(ぴょ,こころ.next);return ぴょーん?!0:!1}return!1}return!0});if(0===ぴょぴょん.length)return!1;var ぴょんぴょん={noteIndex:いつも,forcedHit:null},ぴょんとぴょん=1/0,ぴょーんぴょん=null;return ぴょぴょん.forEach(function(こころ){こころ.before.length<ぴょんとぴょん&&(ぴょんとぴょん=こころ.before.length,ぴょーんぴょん=こころ)}),ぴょんぴょん.appliedRule=ぴょーんぴょん,いつもぴょん.length===ぴょーんぴょん.before.length?(ぴょんぴょん.remainingText=ぴょんと.remainingText.substr(ぴょーんぴょん.after.length),ぴょんぴょん.inputBuffer="",ぴょーんぴょん.next&&(ぴょんぴょん.forcedHit=ぴょーんぴょん.next)):(ぴょんぴょん.remainingText=ぴょんと.remainingText,ぴょんぴょん.inputBuffer=いつもぴょん),ぴょんぴょん},ぴょんと=function(こころ){var ぴょ=ぴょーん.roll[こころ.noteIndex];ぴょーん.currentNoteIndex=こころ.noteIndex,""===こころ.remainingText?(ぴょ.state=ぴょーん.noteState.CLEARED,ぴょ.remainingText="",ぴょーん.inputBuffer="",ぴょーん.currentNoteIndex=null):(ぴょ.state=ぴょーん.noteState.HITTING,ぴょ.remainingText=こころ.remainingText,ぴょーん.inputBuffer=こころ.inputBuffer),ぴょーん.roll.forEach(function(こころ){"note"===こころ.type&&こころ.time<ぴょ.time&&(こころ.state===ぴょーん.noteState.WAITING||こころ.state===ぴょーん.noteState.HITTING)&&いつもぴょーん(こころ)}),こころ.forcedHit&&ぴょーん.hit(こころ.forcedHit,いつも,!0)};if(1===こころ.length){if(null!==ぴょーん.currentNoteIndex){var いつもぴょん=ぴょん(ぴょーん.currentNoteIndex);if(いつもぴょん)return void ぴょんと(いつもぴょん)}var ぴょぴょん=null,ぴょんぴょん=null,ぴょんとぴょん=1/0;ぴょーん.roll.forEach(function(こころ,ぴょ){if("note"===こころ.type&&ぴょ>ぴょーん.currentNoteIndex&&こころ.state===ぴょーん.noteState.WAITING&&Math.abs(こころ.time-いつも)<Math.abs(ぴょんとぴょん)){var ぴょんと=ぴょん(ぴょ);ぴょんと&&(ぴょぴょん=こころ,ぴょんぴょん=ぴょんと,ぴょんとぴょん=こころ.time-いつも)}});var ぴょーんぴょん=ぴょんとぴょん;if(null!==ぴょぴょん){var こころぴょんと=null;if(ぴょーん.settings.judges.some(function(こころ){return こころ.from<=ぴょーんぴょん&&ぴょーんぴょん<=こころ.to?(こころぴょんと=こころ.name,!0):!1}),ぴょ&&null===こころぴょんと&&(こころぴょんと=ぴょーん.judges[ぴょーん.judges.length-1].name),null!==こころぴょんと){if(null!==ぴょーん.currentNoteIndex){var いつもぴょんと=ぴょーん.roll[ぴょーん.currentNoteIndex];いつもぴょーん(いつもぴょんと)}ぴょんと(ぴょんぴょん),こころぴょんと===ぴょーん.settings.breakCombo&&(ぴょーん.combo=0),ぴょーん.combo++,ぴょんぴょーん.onJudgement({judgement:{distance:ぴょーんぴょん,judge:こころぴょんと,combo:ぴょーん.combo}})}}}},this.getKanaLyric=function(こころ){if("undefined"==typeof こころ&&(こころ=ぴょーん.currentLyricIndex),null===こころ)return null;for(var いつも="",ぴょ=こころ+1;ぴょ<ぴょーん.roll.length;ぴょ++)if("note"===ぴょーん.roll[ぴょ].type)いつも+=ぴょーん.roll[ぴょ].text;else if("stop"===ぴょーん.roll[ぴょ].type||"lyric"===ぴょーん.roll[ぴょ].type)break;return いつも};for(var ぴょぴょーん in ぴょん)ぴょん.hasOwnProperty(ぴょぴょーん)&&(void 0===this.settings[ぴょぴょーん]?this.settings[ぴょぴょーん]=ぴょん[ぴょぴょーん]:"number"==typeof this.settings[ぴょぴょーん]?this.settings[ぴょぴょーん]=parseFloat(ぴょん[ぴょぴょーん],10):"string"==typeof this.settings[ぴょぴょーん]&&(this.settings[ぴょぴょーん]=ぴょん[ぴょぴょーん]));this.correction=this.settings.correction+this.settings.controlledCorrection+1e3*this.settings.offset,this.zeroTimePad=this.correction-1e3*this.settings.offset,this.zeroTime=this.correction-1e3*this.settings.offset,this.DOM={wrap:ぴょ.css({width:this.settings.width+"px",height:this.settings.height+"px",margin:"0 auto",position:"relative"}),player:$("<div/>",{id:"youtyping-player"}).appendTo(ぴょ).css({width:this.settings.width+"px",height:this.settings.height+"px",display:"block","z-index":0}),screen:$("<canvas/>",{id:"youtyping-screen","data-paper-keepalive":"true",width:this.settings.width.toString(),height:this.settings.height.toString()}).appendTo(ぴょ).css({width:this.settings.width+"px",height:this.settings.height+"px",position:"absolute",top:0,left:0,"z-index":100})},this.screen=new ぴょんと(document.getElementById("youtyping-screen"),this);var ぴょんぴょーん=this.screen;$.when($.when(ぴょぴょんと(),$.Deferred(this.screen.setup).promise()).done(this.screen.load),ぴょんぴょんと(),ぴょぴょん()).done(this.screen.ready).fail(function(){こころ("ERROR: Initialization Failed...")})},ぴょんと=function(いつも,ぴょ){var ぴょん=this,ぴょんと=0;this.canvas=いつも,this.items={},this.setup=function(いつも){paper.setup(ぴょん.canvas),ぴょん.cover=new paper.Path.Rectangle(paper.view.bounds),ぴょん.cover.fillColor="black",ぴょん.cover.fillColor.alpha=.7,ぴょん.debugTexts=[];for(var ぴょーん=0;5>ぴょーん;ぴょーん++){var こころぴょん=ぴょん.debugTexts.push(new paper.PointText([20,20*(ぴょーん+1)]));ぴょん.debugText=ぴょん.debugTexts[こころぴょん-1],ぴょん.debugText.justification="left",ぴょん.debugText.fillColor="white"}ぴょん.bufferText=new paper.PointText({point:paper.view.bounds.bottomRight.multiply(ぴょ.settings.bufferTextPosition),content:"",fillColor:"white",justification:"left",fontSize:24}),ぴょん.currentLyric=new paper.PointText({point:paper.view.bounds.bottomRight.multiply(ぴょ.settings.currentLyricPosition),content:"",fillColor:"white",justification:"center",fontSize:36}),ぴょん.nextLyric=new paper.PointText({point:paper.view.bounds.bottomRight.multiply(ぴょ.settings.nextLyricPosition),content:"",fillColor:"white",justification:"center",fontSize:18}),ぴょん.kanaLyric=new paper.PointText({point:paper.view.bounds.bottomRight.multiply(ぴょ.settings.kanaLyricPosition),content:"",fillColor:"white",justification:"center",fontSize:24}),ぴょん.judgeEffects=new paper.Group,setInterval(function(){ぴょん.debugTexts[0].content="FPS: "+ぴょんと,ぴょんと=0,ぴょん.debugTexts[2].content="Zerocall FPS: "+ぴょ.zeroCallFPS,ぴょ.zeroCallFPS=0},1e3),こころ("Screen is Set."),いつも.resolve()},this.load=function(){var いつも=ぴょ.settings,ぴょんと=ぴょ.now,ぴょーん=いつも.width*(1-いつも.hitPosition)+いつも.noteSize+いつも.screenPadding,こころぴょん=いつも.width*いつも.hitPosition+いつも.noteSize+いつも.screenPadding;try{ぴょ.roll.forEach(function(こころ){こころ.emergeTime=(いつも.speed*こころ.time-ぴょーん)/いつも.speed,こころ.vanishTime=(いつも.speed*こころ.time+こころぴょん)/いつも.speed}),こころ("Computed roll Parameters.")}catch(いつもぴょん){return こころ("ERROR: Computing roll Parameters Faild: "+いつもぴょん),-1}ぴょ.zeroTime=ぴょんと,ぴょん.update(),ぴょん.hitCircle=new paper.Path.Circle({center:paper.view.bounds.bottomRight.multiply([いつも.hitPosition,いつも.rollYpos]),radius:いつも.noteSize,strokeWidth:1,strokeColor:"white"})},this.ready=function(){ぴょん.pressEnter=new paper.PointText({point:paper.view.bounds.bottomRight.multiply([.5,.8]),content:"Press enter or click here.",justification:"center",fontSize:45,fillColor:"white"});var いつも=function(こころ){("keydown"===こころ.type&&"enter"===こころ.key||"mousedown"===こころ.type)&&(ぴょん.pressEnter.remove(),paper.tool.onKeyDown=null,ぴょん.start())};paper.tool.onKeyDown=いつも,ぴょん.pressEnter.onMouseDown=いつも,こころ("Screen is Ready.")},this.start=function(){こころ("Starting game."),paper.view.onFrame=ぴょん.onFrame,ぴょ.play();var いつも=function(こころ){1===ぴょ.player.getPlayerState()&&"keydown"===こころ.type&&(こころ.preventDefault(),ぴょ.hit(こころ.key))};paper.tool.onKeyDown=いつも},this.update=function(){var こころ=ぴょ.settings,いつも=ぴょん.items,ぴょんと=ぴょ.now,ぴょーん=ぴょんと-ぴょ.zeroTime;ぴょ.roll.forEach(function(ぴょん,ぴょんと){var こころぴょん=(ぴょん.time-ぴょーん)*こころ.speed+こころ.width*こころ.hitPosition;if(ぴょんと in いつも){if(ぴょーん<ぴょん.emergeTime||ぴょん.vanishTime<ぴょーん)return いつも[ぴょんと].remove(),void delete いつも[ぴょんと]}else{if(!(ぴょん.emergeTime<=ぴょーん&&ぴょーん<=ぴょん.vanishTime))return;いつも[ぴょんと]=new paper.Group,"longline"===ぴょん.type&&(いつも[ぴょんと].longLine=いつも[ぴょんと].addChild(new paper.Path.Line({from:[こころぴょん,こころ.rollYpos*こころ.height-こころ.longLineHeight/2],to:[こころぴょん,こころ.rollYpos*こころ.height+こころ.longLineHeight/2],strokeColor:"white",strokeWidth:2}))),"line"===ぴょん.type&&(いつも[ぴょんと].smallLine=いつも[ぴょんと].addChild(new paper.Path.Line({from:[こころぴょん,こころ.rollYpos*こころ.height-こころ.lineHeight/2],to:[こころぴょん,こころ.rollYpos*こころ.height+こころ.lineHeight/2],strokeColor:"white",strokeWidth:1}))),"note"===ぴょん.type&&(いつも[ぴょんと].note=いつも[ぴょんと].addChild(new paper.Path.Circle({center:[こころぴょん,こころ.rollYpos*こころ.height],radius:こころ.noteSize,strokeWidth:1,strokeColor:"#aaa"})),いつも[ぴょんと].lyric=いつも[ぴょんと].addChild(new paper.PointText({point:[こころぴょん,こころ.rollYpos*こころ.height+こころ.noteSize+50],content:ぴょん.remainingText,fillColor:"white",justification:"center",fontSize:20,fontFamily:"sans-serif"}))),"stop"===ぴょん.type&&(いつも[ぴょんと].orderStop=いつも[ぴょんと].addChild(new paper.Path({segments:[[こころぴょん,こころ.rollYpos*こころ.height-こころ.noteSize-30]],fillColor:"white"})),いつも[ぴょんと].orderStop.lineBy([10,-10]),いつも[ぴょんと].orderStop.lineBy([-20,0]),いつも[ぴょんと].orderStop.closed=!0)}"longline"===ぴょん.type&&(いつも[ぴょんと].position.x=こころぴょん),"line"===ぴょん.type&&(いつも[ぴょんと].position.x=こころぴょん),"stop"===ぴょん.type&&(いつも[ぴょんと].position.x=こころぴょん),"note"===ぴょん.type&&(いつも[ぴょんと].position.x=こころぴょん,ぴょん.state===ぴょ.noteState.CLEARED?(いつも[ぴょんと].note.visible=!1,いつも[ぴょんと].lyric.visible=!1):(いつも[ぴょんと].note.style={fillColor:ぴょん.state===ぴょ.noteState.WAITING||ぴょん.state===ぴょ.noteState.HITTING?"red":"#aaa"},いつも[ぴょんと].note.opacity=ぴょん.state===ぴょ.noteState.FAILED||ぴょん.state===ぴょ.noteState.WAITING?1:.5,いつも[ぴょんと].lyric.content=ぴょん.remainingText))})},this.onFrame=function(){1===ぴょ.player.getPlayerState()&&ぴょん.update(),ぴょん.debugTexts[1].content="Measured Zero: "+ぴょ.estimatedZero.toFixed(2),ぴょん.debugTexts[3].content="Active Objects: "+paper.project.activeLayer.children.length,ぴょん.debugTexts[4].content="Zero Time: "+ぴょ.zeroTime.toFixed(2),ぴょん.bufferText.content=ぴょ.inputBuffer,ぴょん.currentLyric.content=ぴょ.currentLyricIndex?ぴょ.roll[ぴょ.currentLyricIndex].text:"",ぴょん.nextLyric.content=ぴょ.nextLyricIndex?ぴょ.roll[ぴょ.nextLyricIndex].text:"",ぴょん.judgeEffects.children.forEach(function(こころ){こころ.controller.onFrame()}),ぴょんと++},this.onPlayerStateChange=function(こころ){ぴょ.DOM.screen.css(こころ.data===YT.PlayerState.PLAYING?{cursor:"none"}:{cursor:"auto"})},this.onJudgement=function(こころ){var いつも=new ぴょーん(こころ.judgement);いつも.item.controller=いつも,ぴょん.judgeEffects.addChild(いつも.item)};var ぴょーん=function(こころ){var いつも=ぴょ.settings;switch(this.item=new paper.Group,this.judgeColor="",こころ.judge){case"perfect":this.judgeColor="yellow";break;case"great":this.judgeColor="#2d1";break;case"good":this.judgeColor="#19a";break;case"bad":this.judgeColor="#aaa"}this.judge=this.item.addChild(new paper.PointText({point:ぴょん.hitCircle.position.add([0,-いつも.noteSize-24]),content:こころ.judge,fillColor:this.judgeColor,justification:"center",fontSize:24,fontFamily:"sans-serif"})),this.combo=this.item.addChild(new paper.PointText({point:ぴょん.hitCircle.position.add([0,-いつも.noteSize]),content:こころ.combo,fillColor:"white",justification:"center",fontSize:15,fontFamily:"sans-serif"})),this.onFrame=function(){this.item.translate([0,-3]),this.item.opacity-=.02,this.item.opacity<0&&this.item.remove()}}};if("undefined"==typeof window.performance&&(window.performance={}),!window.performance.now){var ぴょーん=Date.now();window.performance.now=function(){return Date.now()-ぴょーん}}var こころぴょん=function(こころ,いつも){return こころ.length<いつも.length?!1:こころ.substring(0,いつも.length)===いつも};return ぴょん}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment