Whitney Martinez 7 лет назад
Родитель
Сommit
c2d54b2fce
2 измененных файлов: 13 добавлений и 10 удалений
  1. 9
    8
      js/colors.js
  2. 4
    2
      js/index.js

+ 9
- 8
js/colors.js Просмотреть файл

@@ -1,5 +1,5 @@
1
-var colorsArray : {
2
-    colors=[
1
+colorsArray = {
2
+    colors :[
3 3
         {
4 4
             "name":"green",
5 5
             "red":"64",
@@ -17,7 +17,7 @@ var colorsArray : {
17 17
             red:"192",
18 18
             green:"46",
19 19
             blue:"35"
20
-        }
20
+        },
21 21
         {
22 22
             "name":"blue",
23 23
             "red":"19",
@@ -25,9 +25,10 @@ var colorsArray : {
25 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 Просмотреть файл

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