converted division to multiplication and calculating radius inside func

Co-authored-by: timvisee <tim@visee.me>
This commit is contained in:
Ashesh Vidyut 2019-03-21 01:20:35 +05:30 committed by timvisee
parent acf82a4e3e
commit e5f76a7b1f
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172

View File

@ -24,11 +24,10 @@ module.exports.updateFavicon = function(percentageString) {
const context = canvas.getContext('2d');
canvas.width = canvas.height = size;
context.translate(size / 2, size / 2);
context.translate(size * 0.5, size * 0.5);
const radius = (size - loaderWidth) / 2;
const drawCircle = function(color, lineWidth, percent) {
const drawCircle = function(color, lineWidth, outerWidth, percent) {
const radius = (outerWidth - loaderWidth) * 0.5;
context.beginPath();
context.arc(0, 0, radius, 0, Math.PI * 2 * percent, false);
context.strokeStyle = color;
@ -38,8 +37,8 @@ module.exports.updateFavicon = function(percentageString) {
};
const drawNewFavicon = function() {
drawCircle('#efefef', loaderWidth, 1);
drawCircle(loaderColor, loaderWidth, progress);
drawCircle('#efefef', loaderWidth, size, 1);
drawCircle(loaderColor, loaderWidth, size, progress);
};
drawNewFavicon(link);