Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getRandomColor /* istanbul ignore next */() {
const color = this.$style[`color${getIntInRange(1, this.colorCount)}`];
if (usedColors.indexOf(color) === -1) {
usedColors.push(color);
return color;
} else if (usedColors.length === this.colorCount) {
return this.$style[`color${getIntInRange(1, this.colorCount)}`];
} else {
return this.getRandomColor();
}
},
getOffset(index: number) {
this.interval = setInterval(() => {
this.show = true;
if (this.percent <= 50) {
this.percent += getIntInRange(30, 40);
} /* istanbul ignore next */ else if (this.percent <= 70) {
this.percent += getIntInRange(5, 10);
} /* istanbul ignore next */ else if (this.percent <= 95) {
this.percent += getIntInRange(1, 2);
} else {
this.percent = 99;
}
}, 100);
},
this.interval = setInterval(() => {
this.show = true;
if (this.percent <= 50) {
this.percent += getIntInRange(30, 40);
} /* istanbul ignore next */ else if (this.percent <= 70) {
this.percent += getIntInRange(5, 10);
} /* istanbul ignore next */ else if (this.percent <= 95) {
this.percent += getIntInRange(1, 2);
} else {
this.percent = 99;
}
}, 100);
},
constructor(
private context: CanvasRenderingContext2D | any,
private radius: number,
private speed: number,
private width: number,
private xPos: number,
private yPos: number,
) {
this.direction = getIntInRange(0, 1) === 1 ? -1 : 1;
}
const getCircles = (
circleCount: number,
canvas: HTMLCanvasElement | any,
context: CanvasRenderingContext2D | any,
): Circle[] => {
const localCircles: any[] = [];
for (let i = 0; i < circleCount; i++) {
localCircles.push(
new Circle(
context,
getIntInRange(50, 350),
getFloatInRange(0.1, 1),
getFloatInRange(2, 10),
getIntInRange(0, canvas.width),
getIntInRange(0, canvas.height),
),
);
}
return localCircles;
};
const getCircles = (
circleCount: number,
canvas: HTMLCanvasElement | any,
context: CanvasRenderingContext2D | any,
): Circle[] => {
const localCircles: any[] = [];
for (let i = 0; i < circleCount; i++) {
localCircles.push(
new Circle(
context,
getIntInRange(50, 350),
getFloatInRange(0.1, 1),
getFloatInRange(2, 10),
getIntInRange(0, canvas.width),
getIntInRange(0, canvas.height),
),
);
}
return localCircles;
};
const getCircles = (
circleCount: number,
canvas: HTMLCanvasElement | any,
context: CanvasRenderingContext2D | any,
): Circle[] => {
const localCircles: any[] = [];
for (let i = 0; i < circleCount; i++) {
localCircles.push(
new Circle(
context,
getIntInRange(50, 350),
getFloatInRange(0.1, 1),
getFloatInRange(2, 10),
getIntInRange(0, canvas.width),
getIntInRange(0, canvas.height),
),
);
}
return localCircles;
};
public update(): void {
this.counter += this.direction * this.speed;
const opacityDirection: number = getIntInRange(0, 1) === 1 ? -1 : 1;
this.opacity += opacityDirection * (getIntInRange(0, 999) / 50000);
this.context.beginPath();
this.context.arc(
this.xPos + Math.cos(this.counter / 100) * this.radius,
this.yPos + Math.sin(this.counter / 100) * this.radius,
this.width,
0,
Math.PI * 2,
false,
);
this.context.closePath();
this.context.fillStyle = 'rgba(244, 59, 108,' + this.opacity + ')';
const getErrorWithProbability = (probability: number) => getIntInRange(0, 100) <= probability;
data(): any {
return {
show: false,
id: getIntInRange(213123123, 98982984398),
index: -1,
};
},
methods: {