1 |
- !function(){function n(n,e,t,o,r,u,i){try{var l=n[u](i),a=l.value}catch(s){return void t(s)}l.done?e(a):Promise.resolve(a).then(o,r)}function e(e){return function(){var t=this,o=arguments;return new Promise((function(r,u){var i=e.apply(t,o);function l(e){n(i,r,u,l,a,"next",e)}function a(e){n(i,r,u,l,a,"throw",e)}l(void 0)}))}}System.register(["./App-legacy.2a33c1c9.js"],(function(n){"use strict";var t,o,r,u,i,l;return{setters:[function(n){t=n.d,o=n.O,r=n.bv,u=n.bx,i=n.a,l=n.g}],execute:function(){var a=o({}),s=null;n("default",t({name:"VelFlowTest",data:function(){return{xml:"https://oss.dayaedu.com/cloud-coach/1661242248370尤克里里-测试-音阶.xml"}},computed:{isHidden:function(){return a&&a.cursor&&a.cursor.Hidden}},mounted:function(){var n=this;return e(regeneratorRuntime.mark((function e(){var t,o,i,l,s,c,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(l in(a=new r(document.querySelector("#container1"),{backend:"svg",drawTitle:!0,coloringSetCustom:["#00ff00"],cursorsOptions:[{type:0,color:"green",alpha:1,follow:!0}]})).EngravingRules.StaffLineColor="rgba(238,128,196,1)",a.EngravingRules.DefaultColorCursor="rgba(238,128,196,1)",n.handleJianpu(n.xml),t=document.getElementById("glyphs"),o=0,i=0,u.Flow.Font.glyphs)u.Flow.Font.glyphs[l]=u.Flow.Font.glyphs[l],i++;for(l in s=(i+1)/(800/240)*60,t.height=s,t.width=800,(c=t.getContext("2d")).font="14pt Courier",f=60,u.Flow.Font.glyphs)c.fillStyle="#222",c.fillText(l,o,f),o+=60,c.fillStyle="green",u.Flow.Font.glyphs[l].o&&((d=new u.Flow.Glyph(l,45)).render(c,o,f),c.save(),c.font="6pt Arial",d.getMetrics(),c.restore()),(o+=60)>=800&&(o=0,f+=120);case 15:case"end":return e.stop()}}),e)})))()},methods:{handleJianpu:function(){var n=arguments,t=this;return e(regeneratorRuntime.mark((function e(){var o,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.length>0&&void 0!==n[0]?n[0]:"",r=n.length>1&&void 0!==n[1]?n[1]:"staff",a.EngravingRules.DYMusicScoreType=r,e.next=5,a.load(o);case 5:a.render(),console.log(a),t.getAllNote(),a.cursor.reset();case 9:case"end":return e.stop()}}),e)})))()},getAllNote:function(){var n=[];a.cursor.reset();for(var e=a.cursor.Iterator;!e.EndReached;){for(var t,o,r,u=null!==(t=e.CurrentVoiceEntries)&&void 0!==t&&t[0]?[null===(o=e.CurrentVoiceEntries)||void 0===o?void 0:o[0]]:[],i=null===(r=e.CurrentVoiceEntries)||void 0===r?void 0:r[1],l=0;l<u.length;l++)for(var s=u[l].Notes,c=0;c<s.length;c++){var f=s[c];null==f||0==f.halfTone||f.isRest()||n.push({note:f.halfTone+12,time:4*e.currentTimeStamp.RealValue,halfTone1:s.map((function(n){return n.halfTone+12})).filter(Boolean),halfTone2:i&&Array.isArray(i.notes)?i.notes.map((function(n){return n.halfTone+12})).filter(Boolean):[]})}e.moveToNext()}console.log(n)},onNext:function(){a.cursor.next(),console.log(a.cursor)},onReset:function(){a.cursor.reset()},onToggle:function(){a.cursor.Hidden?a.cursor.show():a.cursor.hide()},autoPlay:function(){clearTimeout(s);var n=0;s=setInterval((function(){console.log(a.cursor.cursorElement.style.display),(new Date).getTime()-n>2e3&&a.cursor.next(),n=(new Date).getTime(),console.log(a.cursor.cursorElement.style.display)}),1e3)}},render:function(){var n=this;return i("div",null,[i("button",{onClick:function(){return n.handleJianpu(n.xml,"jianpu")}},[l("简谱")]),i("button",{onClick:function(){return n.handleJianpu("/jianpu/四二拍-案例0629.xml","jianpu")}},[l("四二")]),i("button",{onClick:function(){return n.handleJianpu("/jianpu/四三拍-案例0629.xml","jianpu")}},[l("四三")]),i("button",{onClick:function(){return n.handleJianpu("/jianpu/四四拍-案例0629.xml","jianpu")}},[l("四四")]),i("button",{onClick:function(){return n.handleJianpu("/jianpu/八三拍-案例0629_jp.xml","jianpu")}},[l("八三")]),i("button",{onClick:function(){return n.handleJianpu("/jianpu/八六拍-案例0629.xml","jianpu")}},[l("八六")]),i("div",null,[i("button",{onClick:this.onNext},[l("next")]),i("button",{onClick:this.onReset},[l("reset")]),i("button",{onClick:this.onToggle},[l("隐藏cursor")]),i("button",{onClick:this.onToggle},[l("显示cursorsh")]),i("button",{onClick:this.autoPlay},[l("自动")])]),i("div",{id:"container1"},null),i("canvas",{id:"glyphs",width:"800",height:"1600"},[l("HTML5 Canvas not supported on this browser.")])])}}))}}}))}();
|