click below
click below
Normal Size Small Size show me how
Vidcode Module 6-1
| Question | Answer |
|---|---|
| while loop | A while loop runs while a specific condition is true. As soon as that condition is not true, it stops. |
| Infinite loop | When a while loop's condition is always true and it never reaches a point where stops. |
| loop | A sequence of code that repeats. |
| What would this code do? Line 1: while (r < movie.width/2 + 40) { Line 2: var my_circle = circle(movie.width/2, movie.height/2, r, "clear"); Line 3: my_circle.borderWidth = r/35; Line 4: my_circle.borderColor = circle_color[i%circle_color.length]; Line 5: i++; Line 6: r += 10 + Math.random() * 15; } | Line 1: creates nested circles Line 2: places the circle in the center of the movie Line 3: the borderWidth property is used to make the border grow thicker as the circles get larger Line 4: changes the borderColor of the circle using the index 'i' Line 5: Increments the index to the next color Line 6: makes the radius of the circle larger (+=) by 10 plus a random Number between 0-15 |