Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sk66641 committed Apr 16, 2024
1 parent 48b22ba commit ff9e509
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
44 changes: 37 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
This simulator takes three input: <br>
# Random Disco Light Simulator

#inputs:<br>
1:) What type of gradient you want to choose (conic or linear)?<br>
2:) By how much time interval (in milliseconds) you want to change the colors?<br>
3:) How many random colors you want to be shown?
## This simulator takes three inputs:

#output:<br>
On the basis of these three inputs, it simulates conic or linear view for given number of random colors and time interval.
### Inputs:

1. How many random colors you want to be shown?
2. By how much time interval (in milliseconds) you want to change the colors randomly?<br>
3. What type of gradient you want to choose (conic or linear)?<br>

### Output:

On the basis of these three inputs, it simulates conic or linear view for given number of random colors and time interval.

### Try these inputs:
<table>
<tr>
<td>1:)</td>
<td>1000</td>
<td>2</td>
<td>1000</td>
<td>7</td>
</tr>
<tr>
<td>2:)</td>
<td>1</td>
<td>500</td>
<td>1</td>
<td>500</td>
</tr>
<tr>
<td>3:)</td>
<td>conic</td>
<td>linear</td>
<td>linear</td>
<td>conic</td>
</table>

### Have a fun! 😄
14 changes: 7 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ let random_color = `${getRandomColor()}`;

/* do {
var type = prompt("1:) To choose gradient between conic & linear, Type: \n -> 'c' or 'C' for conic \n -> 'l' or 'L' for linear");
var view = prompt("1:) To choose gradient between conic & linear, view: \n -> 'c' or 'C' for conic \n -> 'l' or 'L' for linear");
if (type != 'c' && type != 'l' && type != 'C' && type != 'L') {
if (view != 'c' && view != 'l' && view != 'C' && view != 'L') {
alert("Please enter 'c' or 'C' for conic or 'l' or 'L' for linear");
}
} while (type != 'c' && type != 'l' && type != 'C' && type != 'L');
} while (view != 'c' && view != 'l' && view != 'C' && view != 'L');
do {
Expand All @@ -42,9 +42,9 @@ do {
} while (isNaN(n) || n < 1 || Number.isInteger(n) == false); */

let type = prompt("1:) To choose gradient between conic & linear, Enter: \n -> 'c' or 'C' for conic \n -> 'l' or 'L' for linear");
let n = Number(prompt("1:) Enter the number of random colors:"));
let set_time = Number(prompt("2:) Set the time interval (in 'milliseconds') with which the color changes randomly:\n(Negative interval or no input will be treated as 0 interval)"));
let n = Number(prompt("3:) Enter number of random colors:\n(Enter a positive integer greater than or equal to 1)"));
let view = prompt("3:) To choose gradient between conic & linear, Enter: \n -> 'c' or 'C' for conic \n -> 'l' or 'L' for linear");
// alert("𝘙𝘢𝘯𝘥𝘰𝘮 𝘋𝘪𝘴𝘤𝘰 𝘓𝘪𝘨𝘩𝘵 𝘚𝘪𝘮𝘶𝘭𝘢𝘵𝘰𝘳 (𝘸𝘪𝘵𝘩 💖 𝘣𝘺 '𝘬𝘶𝘮𝘢𝘳 𝘴𝘢𝘯𝘶')");

function number(n) {
Expand Down Expand Up @@ -77,7 +77,7 @@ if (n == 1) {

else if (n > 1) {

if (type == "c" || type == "C") {
if (view == "c" || view == "C" || view == "conic" || view == "Conic") {

document.body.style.background = `conic-gradient(${random_color}, ${number(n - 1)} ${random_color})`;
setInterval(() => {
Expand All @@ -86,7 +86,7 @@ else if (n > 1) {
}, `${set_time}`);

}
else if (type == "l" || type == "L") {
else if (view == "l" || view == "L" || view == "linear" || view == "Linear") {

document.body.style.background = `linear-gradient(${number(n - 1)} ${random_color})`;
setInterval(() => {
Expand Down

0 comments on commit ff9e509

Please sign in to comment.