Lab #21 Fun With HTML5 Canvas
Lab #21 is titled "Fun With HTML5 Canvas". In this lab, I create a canvas on a webpage that users can draw on using their mouse by holding left-click or right-click and moving their mouse on the screen. The screenshot below is an example of me drawing "Hello !!!" upon the canvas.
To create this canvas, I used HTML, little CSS, and JavaScript. The HTML on my page consisted of using the <canvas> tag with a set width and height to cover a good portion of the page as well as an id called "draw". In my JavaScript, I used a selector to focus on the canvas in my HTML and then set the stroke style to change when you reach a certain point on the page. Notice how the left of the page is colored red and it flows to yellow, then green, to blue, and so on. Also, the modifications of the stroke change based on the location of your mouse on the page as well, like the line type, width, hue, etc.
Web designers would want to know how to do this as it allows for creative ideas of art webpages that allow users to draw on it, or just for the fun of painting. A web designer might want users to interact with the page to draw something for a game of some sort, or sell a website made to create art and share it. There are definitely better ideas that can grow from this kind of tool. The canvas awaits, web designers!
To create this canvas, I used HTML, little CSS, and JavaScript. The HTML on my page consisted of using the <canvas> tag with a set width and height to cover a good portion of the page as well as an id called "draw". In my JavaScript, I used a selector to focus on the canvas in my HTML and then set the stroke style to change when you reach a certain point on the page. Notice how the left of the page is colored red and it flows to yellow, then green, to blue, and so on. Also, the modifications of the stroke change based on the location of your mouse on the page as well, like the line type, width, hue, etc.
Web designers would want to know how to do this as it allows for creative ideas of art webpages that allow users to draw on it, or just for the fun of painting. A web designer might want users to interact with the page to draw something for a game of some sort, or sell a website made to create art and share it. There are definitely better ideas that can grow from this kind of tool. The canvas awaits, web designers!

Comments
Post a Comment