Web Visualization with HTML5, CSS3, and JavaScript Season 1 Episode 16 Creating a Polygon
- November 22, 2015
- 6 min
Web Visualization with HTML5, CSS3, and JavaScript is an educational television show that focuses on teaching viewers how to create stunning web visualizations using the latest web technologies. In season 1 episode 16, titled "Creating a Polygon," viewers learn how to use HTML5, CSS3, and JavaScript to create a polygon that can be used in web visualizations.
The episode starts by introducing viewers to the concept of polygons and their importance in web visualization. The host explains that polygons are a type of shape that is commonly used in visualizations, particularly when representing geographic shapes such as countries or states. They are made up of a series of points that are connected to form a closed shape.
Next, the host dives into the code, demonstrating step-by-step how to create a polygon using HTML5, CSS3, and JavaScript. The first step is to create a canvas element in the HTML document, which will serve as the container for the polygon. The host then shows viewers how to use CSS3 to style the canvas element, setting the height, width, and background color.
Once the canvas element is ready, the host moves on to creating the polygon itself. To do this, viewers learn how to use JavaScript to define the points that make up the polygon. The host shows viewers how to use an array to store the x and y coordinates of each point in the polygon, and how to use a for loop to iterate over the array and plot each point on the canvas element.
With the points in place, the host shows viewers how to use JavaScript to connect the points and create the polygon. This involves using the canvas element's drawing API to create a path, moving the path to the first point, and then using the lineTo method to draw lines between each subsequent point in the array. By the end of this step, viewers will have a complete polygon on their canvas element.
To round out the episode, the host shows viewers how to add additional styling to the polygon using CSS3. This includes adding a border around the polygon, setting the border color and width, and adding transparency using the rgba color format. With these additional styling elements in place, viewers will have a visually appealing polygon that can be used in their web visualizations.
Overall, season 1 episode 16 of Web Visualization with HTML5, CSS3, and JavaScript is a comprehensive and informative look at how to create a polygon using the latest web technologies. Whether you're an experienced web developer or a newcomer to the field, this episode is sure to provide valuable insights and tips for creating stunning web visualizations.