"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _readOnlyError(t){throw new TypeError('"'+t+'" is read-only')}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r.5?5:-5),a=.8*e,o=.2*e;this.bezierPoints={start:[r,i],end:[r,0],p1:[n,a],p2:[n,o]}}},{key:"getIconImg",value:function(){var t=this,e=count%this.imgList.length;count++;var r=this.imgList[e];if(imageMap.has(r))return this.imgLoadSuccess=!0,imageMap.get(r);if(!r||"string"!=typeof r)return null;r.startsWith("//")&&_readOnlyError("imgUrl");var i=this.canvas.createImage();return i.onload=function(){t.imgLoadSuccess=!0,imageMap.set(r,i)},i.onerror=function(t){console.error("Thumb image load error",t,r)},i.src=r,i}},{key:"calcRangle",value:function(){this.rangle=Math.random()>.5?10:-10}},{key:"update",value:function(){return this.t>1?(this.isFinish=!0,!1):(this.t+=this.speed,!0)}},{key:"draw",value:function(t){if(this.imgLoadSuccess&&this.img){t.save();var e=this.bezierPoints,r=e.start,i=e.end,n=e.p1,a=e.p2,o=threeBezier(this.t,r,n,a,i);t.translate(o[0],o[1]),t.rotate(this.rangle*(Math.PI/180));var s=this.calcScale();t.scale(s,s),t.globalAlpha=this.calcOpacity();var l=this.drawSize;t.drawImage(this.img,-l/2,-l/2,l,l),t.restore()}}},{key:"calcOpacity",value:function(){if(this.t>.9||this.t<.15)return.1;if(this.t>.8){var t=1-10*(this.t-.8);return Math.max(t,.1)}return.8}},{key:"calcScale",value:function(){return Math.min(10*this.t,1)}}]),t}();exports.ThumbsItem=ThumbsItem;