JS Traffic Light Fill Problem
Hi, I have a problem with some JavaScript, which is changing traffic lights. Here is the code:
Code:
<html> Can anyone help? Thanks |
Took me a while to notice; since I never do javascript :-)
You should see that each of your ciX variables are getElementById("myCanvas"); Each of those gets a 2d context from the same canvas. There is actually the issue: they're all the same; when you do your initial painting, you first paint circle 1, then 2 and finally the third. So each time they get 'updated' to the last circle painted; which hides this issue. Since I never do javascript, I may be a bit off and certainly cannot provide a solution... would be cool... I love traffic lights :-) (When they're green for me and red for the rest) To summarize: I think your 'lights' should become really separate objects. |
Also, since this is quite obviously a homework problem :tisk: you should always ask your instructor first.
|
All times are GMT -5. The time now is 05:00 AM. |