/* 录音 https://github.com/xiangyuecn/Recorder src: extensions/waveview.js */ !function(){var e=function(e){return new t(e)},g="WaveView",t=function(e){var t=this,a={scale:2,speed:9,phase:21.8,fps:20,keep:!0,lineWidth:3,linear1:[0,"rgba(150,96,238,1)",.2,"rgba(170,79,249,1)",1,"rgba(53,199,253,1)"],linear2:[0,"rgba(209,130,255,0.6)",1,"rgba(53,199,255,0.6)"],linearBg:[0,"rgba(255,255,255,0.2)",1,"rgba(54,197,252,0.2)"]};for(var i in e)a[i]=e[i];t.set=e=a;var r=e.elem;r&&("string"==typeof r?r=document.querySelector(r):r.length&&(r=r[0])),r&&(e.width=r.offsetWidth,e.height=r.offsetHeight);var n=e.scale,h=e.width*n,o=e.height*n;if(!h||!o)throw new Error(g+"无宽高");var l=t.elem=document.createElement("div"),s=["","transform-origin:0 0;","transform:scale("+1/n+");"];l.innerHTML='
';var c=t.canvas=l.querySelector("canvas"),d=t.ctx=c.getContext("2d");c.width=h,c.height=o,t.linear1=t.genLinear(d,h,e.linear1),t.linear2=t.genLinear(d,h,e.linear2),t.linearBg=t.genLinear(d,o,e.linearBg,!0),r&&(r.innerHTML="",r.appendChild(l)),t._phase=0};t.prototype=e.prototype={genLinear:function(e,t,a,i){for(var r=e.createLinearGradient(0,0,i?0:t,i?t:0),n=0;n