mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-13 22:54:15 +01:00
converted division to multiplication and calculating radius inside func
Co-authored-by: timvisee <tim@visee.me>
This commit is contained in:
parent
acf82a4e3e
commit
e5f76a7b1f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user