Commit 56fdfef7 authored by Kulpybaev Ilyas's avatar Kulpybaev Ilyas

Дз-26 задание 5

parent f7129fcd
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js/jQuery.js"></script>
<title>Document</title>
</head>
<body>
<script src="js/circle.js"></script>
</body>
</html>
\ No newline at end of file
const getRandomNum = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
const getPosition = (min, max) => {
console.log(min, max);
return getRandomNum(min, max);
}
const drawCircles = (count) => {
for (let i = 0; i < count; i++){
let element = document.createElement('div');
let size = getRandomNum(50, 200);
let color = `rgba(${getRandomNum(1, 255)}, ${getRandomNum(1, 255)}, ${getRandomNum(1, 255)}, 0.8)`
element.style.width = size + 'px';
element.style.height = size + 'px';
element.style.position = 'absolute';
element.style.borderRadius = '50%';
element.style.backgroundColor = color;
element.style.left = getPosition(0, window.innerWidth - size) + 'px';
element.style.top = getPosition(0, window.innerHeight - size) + 'px';
document.body.appendChild(element);
}
};
let counter = prompt('Enter a count');
drawCircles(parseInt(counter));
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment