Kate Moore 7 jaren geleden
bovenliggende
commit
64636ba67e
2 gewijzigde bestanden met toevoegingen van 12 en 13 verwijderingen
  1. 7
    8
      js/colors.js
  2. 5
    5
      js/index.js

+ 7
- 8
js/colors.js Bestand weergeven

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

+ 5
- 5
js/index.js Bestand weergeven

@@ -39,10 +39,10 @@ window.onload = function()
39 39
 		this.g = Math.round(Math.random()*255);
40 40
 		this.b = Math.round(Math.random()*255);*/
41 41
 
42
-		this.randomColor = randomInt(0,colorsArray.colors.length-1);
43
-		this.r = colorsArray.colors[this.randomColor].red;
44
-		this.g = colorsArray.colors[this.randomColor].green;
45
-		this.b = colorsArray.colors[this.randomColor].blue;
42
+		this.randomColor = randomInt(0,colorsArray.length-1);
43
+		this.r = colorsArray[this.randomColor].red;
44
+		this.g = colorsArray[this.randomColor].green;
45
+		this.b = colorsArray[this.randomColor].blue;
46 46
 
47 47
 		console.log(colorsArray);
48 48
 
@@ -136,4 +136,4 @@ window.onload = function()
136 136
 	//set interval so we can draw then update our drawing
137 137
 	// every 30 milisecond
138 138
 	setInterval(draw,30);
139
-}
139
+}