{"version":3,"file":"anim_progress_radial.min.js","sources":["../src/anim_progress_radial.js"],"sourcesContent":["/* jshint ignore:start */\ndefine(['jquery', 'core/log'], function ($, log) {\n\n    \"use strict\"; // jshint ;_;\n\n    log.debug('Radial Progress: initialising');\n\n    return {\n\n        playcanvas: null,\n        context: null,\n        x: null,\n        y: null,\n        currenttime: 0,\n        enabled: false,\n        showpercent: false,\n        drawparams: {\n            lineWidth: 10,\n            barColor: '#ad2323',\n            shadowOffsetX: 0,\n            shadowOffsetY: 0,\n            shadowBlur: 10,\n            shadowColor: '#fff',\n            font: '18px Arial',\n            textAlign: \"center\",\n            textBaseline: 'middle'\n        },\n\n\n        //for making multiple instances\n        clone: function () {\n            return $.extend(true, {}, this);\n        },\n\n        //pass in config, the jquery video/audio object, and a function to be called when conversion has finshed\n        init: function (playcanvas, barcolor, showpercent) {\n            //stash the key actors for calling from draw\n            this.playcanvas = playcanvas.get(0);\n            this.x = this.playcanvas.width / 2;\n            this.y = this.playcanvas.height / 2;\n            this.context = this.playcanvas.getContext('2d');\n            if (showpercent) {\n                this.showpercent = showpercent;\n            }\n            if (showpercent) {\n                this.setDrawParam('barColor', barcolor);\n            }\n        },\n\n        setDrawParam: function (paramkey, paramvalue) {\n            this.drawparams[paramkey] = paramvalue;\n        },\n\n        clear: function () {\n            this.context.clearRect(0, 0, this.playcanvas.width, this.playcanvas.height);\n        },\n        fetchCurrent: function () {\n            return 0;\n        },\n\n        stop: function () {\n            this.enabled = false;\n            //this.clear();\n        },\n\n        start: function () {\n            this.clear();\n            this.enabled = true;\n            var that = this;\n\n            //set draw params, l\n            this.context.lineWidth = this.drawparams.lineWidth;\n            this.context.strokeStyle = this.drawparams.barColor;\n            this.context.setLineDash([]);\n            this.context.shadowOffsetX = this.drawparams.shadowOffsetX;\n            this.context.shadowOffsetY = this.drawparams.shadowOffsetY;\n            this.context.shadowBlur = this.drawparams.shadowBlur;\n            this.context.shadowColor = this.drawparams.shadowColor;\n            this.context.font = this.drawparams.font;\n            this.context.textAlign = this.drawparams.textAlign;\n            this.context.textBaseline = this.drawparams.textBaseline;\n\n\n            var draw = function () {\n                if (!that.enabled) {\n                    return;\n                }\n                that.clear();\n                var radius = Math.min(that.x, that.y) - that.context.lineWidth;//65;\n                var counterClockwise = false;\n                var circ = Math.PI * 2;\n                var quart = Math.PI / 2;\n                var current = that.fetchCurrent();\n                that.context.beginPath();\n                that.context.arc(that.x, that.y, radius, -(quart), ((circ) * current) - quart, counterClockwise);\n\n                //draw progress if we are doing that\n                if (that.showpercent) {\n                    that.context.fillText(parseInt(current * 100) + '%', that.x, that.y);\n                }\n\n                that.context.stroke();\n\n                var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||\n                    window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n                requestAnimationFrame(draw);\n\n            }//end of draw\n            draw();\n        }//end of enable\n    };//end of returned object\n});//total end\n"],"names":["define","$","log","debug","playcanvas","context","x","y","currenttime","enabled","showpercent","drawparams","lineWidth","barColor","shadowOffsetX","shadowOffsetY","shadowBlur","shadowColor","font","textAlign","textBaseline","clone","extend","this","init","barcolor","get","width","height","getContext","setDrawParam","paramkey","paramvalue","clear","clearRect","fetchCurrent","stop","start","that","strokeStyle","setLineDash","draw","radius","Math","min","circ","PI","quart","current","beginPath","arc","fillText","parseInt","stroke","window","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame"],"mappings":"AACAA,4CAAO,CAAC,SAAU,aAAa,SAAUC,EAAGC,YAIxCA,IAAIC,MAAM,iCAEH,CAEHC,WAAY,KACZC,QAAS,KACTC,EAAG,KACHC,EAAG,KACHC,YAAa,EACbC,SAAS,EACTC,aAAa,EACbC,WAAY,CACRC,UAAW,GACXC,SAAU,UACVC,cAAe,EACfC,cAAe,EACfC,WAAY,GACZC,YAAa,OACbC,KAAM,aACNC,UAAW,SACXC,aAAc,UAKlBC,MAAO,kBACIpB,EAAEqB,QAAO,EAAM,GAAIC,OAI9BC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