Tuesday, August 7, 2018
Traffic Light (HTML/JavaScript)
New small open source project available on GitHub. I have been often creating traffic related software, so here is a traffic light for vehicles created in HTML/JavaScript. The traffic light states are stored into an array of frames (numbers that signify each state). There are five traffic light states in total. The timer interval is set to 100 milliseconds. This traffic light can be easily created in less than 100 lines of code. The canvas is responsive (it can fit to different screen sizes). That feature is realized with a combination of CSS and JavaScript. JavaScript code uses window resize event for handling size changes.
Try it online at: https://nihadliu.github.io/traffic-light/
Visit my GitHub profile: https://github.com/nihadliu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment