Whitney Martinez 7 anni fa
parent
commit
c2d54b2fce
2 ha cambiato i file con 13 aggiunte e 10 eliminazioni
  1. 9
    8
      js/colors.js
  2. 4
    2
      js/index.js

+ 9
- 8
js/colors.js Vedi File

1
-var colorsArray : {
2
-    colors=[
1
+colorsArray = {
2
+    colors :[
3
         {
3
         {
4
             "name":"green",
4
             "name":"green",
5
             "red":"64",
5
             "red":"64",
17
             red:"192",
17
             red:"192",
18
             green:"46",
18
             green:"46",
19
             blue:"35"
19
             blue:"35"
20
-        }
20
+        },
21
         {
21
         {
22
             "name":"blue",
22
             "name":"blue",
23
             "red":"19",
23
             "red":"19",
25
             "blue":"144",
25
             "blue":"144",
26
         },
26
         },
27
         {
27
         {
28
-            "name"="orange",
29
-            "red"="253",
30
-            "green"="92",
31
-            "blue"="48"
32
-        },
28
+            "name":"orange",
29
+            "red":"253",
30
+            "green":"92",
31
+            "blue":"48"
32
+        }
33
     ]
33
     ]
34
+}

+ 4
- 2
js/index.js Vedi File

3
   return Math.floor(Math.random() * (max - min + 1)) + min;
3
   return Math.floor(Math.random() * (max - min + 1)) + min;
4
 }
4
 }
5
 
5
 
6
+var randomColor;
7
+
6
 window.onload = function()
8
 window.onload = function()
7
 {
9
 {
8
 	// lets git the HTML canvas element so we draw on it
10
 	// lets git the HTML canvas element so we draw on it
35
 		this.height = 20;
37
 		this.height = 20;
36
 
38
 
37
 		//random colors for our box
39
 		//random colors for our box
38
-		/*this.r = Math.round(Math.random()*255);
40
+		this.r = Math.round(Math.random()*255);
39
 		this.g = Math.round(Math.random()*255);
41
 		this.g = Math.round(Math.random()*255);
40
-		this.b = Math.round(Math.random()*255);*/
42
+		this.b = Math.round(Math.random()*255);
41
 
43
 
42
 		this.randomColor = randomInt(0,colorsArray.colors.length-1);
44
 		this.randomColor = randomInt(0,colorsArray.colors.length-1);
43
 		this.r = colorsArray.colors[this.randomColor].red;
45
 		this.r = colorsArray.colors[this.randomColor].red;