<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Allison Assifuah</title>
    <description>The latest articles on DEV Community by Allison Assifuah (@_aaallison).</description>
    <link>https://dev.to/_aaallison</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1075807%2F2018131e-0674-4709-8a9a-1988ac4c2797.jpg</url>
      <title>DEV Community: Allison Assifuah</title>
      <link>https://dev.to/_aaallison</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_aaallison"/>
    <language>en</language>
    <item>
      <title>Embracing the Mobile-First Approach(design).</title>
      <dc:creator>Allison Assifuah</dc:creator>
      <pubDate>Fri, 09 Jun 2023 11:24:13 +0000</pubDate>
      <link>https://dev.to/_aaallison/embracing-the-mobile-first-approachdesign-i7b</link>
      <guid>https://dev.to/_aaallison/embracing-the-mobile-first-approachdesign-i7b</guid>
      <description>&lt;p&gt;&lt;strong&gt;Table of content:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;The mobile-first approach&lt;/li&gt;
&lt;li&gt;Difference between mobile-first design and responsive web design&lt;/li&gt;
&lt;li&gt;Why opt for mobile-first approach&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a id="item-one"&gt;&lt;/a&gt;&lt;a id="item-one"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;According to &lt;a href="https://www.statista.com/statistics/218984/number-of-global-mobile-users-since-2010/#:~:text=In%202021%2C%20the%20number%20of,projected%20to%20reach%207.49%20billion."&gt;Statista&lt;/a&gt;, 7.1 billion people worldwide used mobile devices in 2021. This number is projected to reach 7.49 billion by 2025. Over 80% of these mobile users browse the web on their mobile devices, and up to 70% of web traffic comes from mobile devices. Half of the world’s internet users (approximately 3.4 billion) browse the web through smartphones.&lt;br&gt;
This means the likelihood of having more people with mobile devices visiting your website is higher than those using desktops. In this article, we delve into the importance of adopting the mobile-first approach in coding, exploring its benefits, and how it enhances user experience across all devices.&lt;/p&gt;

&lt;p&gt;Before mobile phones and tablets became popular, web developers and web designers designed and wrote code for webpages with only computer screens in mind. It was also common for these web pages to have fixed sizes and a static design. Later, mobile phones became popular. It became clear that these fixed and static web pages were not suitable to view on mobile devices. As a result, designers and web developers had to find a way to make webpages work better on all kinds of screens.&lt;/p&gt;

&lt;p&gt;Different solutions were developed to help make webpages more accessible to all types of device screens.  &lt;strong&gt;Adaptive web design&lt;/strong&gt; was the first solution embraced. Adaptive web design involved creating different versions of designs for different screen sizes.  This process was tedious and time-consuming. Moreover, it was difficult to maintain many versions of a website.&lt;/p&gt;

&lt;p&gt;In response to this problem, designers and web developers came up with a different approach to make screens more flexible and adaptable. This new approach was called &lt;strong&gt;Responsive web design&lt;/strong&gt;. Responsive web design involves creating webpages that can change and adjust themselves to fit different devices.  The layout and design in responsive web design are done by resizing, hiding, shrinking, or enlarging, parts of the web page so it looks good on all devices(desktops, tablets, and phones). Responsive web design automatically shifts web page content to fit different screen sizes. Even though this method seems better, responsive web design also has disadvantages. For example, it can sometimes be difficult to control the layout of content on smaller screens. Using features such as panning, zooming, and scrolling on responsive web pages can become a headache.&lt;/p&gt;

&lt;p&gt;Compared to adaptive web design, responsive web design was not time-consuming and easier to maintain.  Respond web design eliminates the need for web developers and designers to create different versions for each screen size. &lt;/p&gt;

&lt;p&gt;Responsive web design sounds and looks way better right? All web pages developed nowadays are responsive.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-two"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What about the mobile-first approach?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;mobile-first approach&lt;/strong&gt; involves creating webpages with mobile users as your primary focus. When designing a webpage, the designer starts by designing for mobile devices and then scale up to larger screens. Similarly, when a web developer codes a webpage, they begin with the smallest screen size and then expand it to fit larger screens. &lt;/p&gt;

&lt;p&gt;All mobile-first designs and codes are responsive, but not all responsive web pages are mobile-first. This may seem confusing, so let me explain the difference.  &lt;/p&gt;

&lt;p&gt;&lt;a id="item-three"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Difference between a responsive web design and a mobile-first design.
&lt;/h2&gt;

&lt;p&gt;The main difference between responsive web design and mobile-first design is the approach that designers and developers take when building a website. Responsive web design allows designers and developers to start building or designing for any screen size. They can start with the largest screen and work their way down to the smallest screen, or they can start with the smallest screen and work their way up to the largest screen. Mobile-first web design, on the other hand, requires designers and developers to strictly start with the smallest screen and work their way up to the largest screen.&lt;/p&gt;

&lt;p&gt;Both responsive and mobile-first web designs make websites accessible on all devices. However, a mobile-first design offers a better overall experience for users. This is because, mobile-first design considers a variety of factors during the design and development phase, such as whitespace, font size, and load time.  &lt;/p&gt;

&lt;p&gt;Here is a table that summaries the key difference between responsive web design and mobile-first design:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Responsive web design&lt;/th&gt;
&lt;th&gt;Mobile-First design&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Starting  point&lt;/td&gt;
&lt;td&gt;Desktop or larger screens size&lt;/td&gt;
&lt;td&gt;Smallest screen size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Adaptability&lt;/td&gt;
&lt;td&gt;Responsive to different screen sizes&lt;/td&gt;
&lt;td&gt;Starts with mobile and adapts to larger screens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Websites that have an existing desktop design and need to adapt it for mobile devices&lt;/td&gt;
&lt;td&gt;Websites or applications with a primary focus on mobile users, aiming for optimized mobile experience&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a id="item-four"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you should use the mobile-first approach.
&lt;/h2&gt;

&lt;p&gt;The importance of adopting the mobile-first approach often sparks debate among web developers. Some argue that as long as the end-user can view and interact with the webpage, that should be the primary concern. However, using mobile has many advantages such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Priority in Search Engine Ranking. Search engines, such as Google, rank mobile-friendly websites first in their search results.  This means that the Google smartphone bot crawls the website and then assess how mobile-friendly the content of the website is. Sites created on the mobile-first design principle are given a certain priority by default. Using the mobile-first approach, web developers can boost their chances of ranking higher in mobile searches. This results in improved visibility and organic traffic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Designing and developing using the mobile-first approach helps make you prioritize user needs. A straightforward webpage that focuses on the main content and functionality helps to ensure that consumers can locate what they are looking for fast and effortlessly. It forces designers and developers to only show the necessary information needed by the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accessibility.  Accessibility is the practice of ensuring that information is available and usable for as many people as possible.    Mobile devices are often used in a variety of situations and environments. The mobile-first approach promotes accessibility by ensuring that websites are functional for persons with impairments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;According to a &lt;a href="https://blog.google/products/admanager/the-need-for-mobile-speed/#:~:text=53%25%20of%20visits%20are%20likely,than%203%20seconds%20to%20load&amp;amp;text=One%20out%20of%20two%20people,in%20less%20than%202%20seconds"&gt;survey&lt;/a&gt; made by Google, 57% of visitors are likely to not return to a website if the loading performance is poor. Not optimizing your website for mobile users means losing users. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mobile-first approach helps reduce redundancy in web developers codebase. By starting with the mobile version and progressively enhancing it for larger screens, developers avoid unnecessary code modifications and duplications. This method simplifies the creation process, increases efficiency, and allows for easier maintenance and upgrades. Mobile-first design ensures cleaner, more maintainable, and future-proof code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id="item-five"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The decision of which approach to use for designing and developing webpages is ultimately up to you. However, opting for the mobile-first approach can offer several benefits. It saves you time, reduces the amount of code you need to write, and ensures that your end-users still enjoy a positive experience.&lt;br&gt;
 Thank you for reading. Feel free to share your opinions in the comments section.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>discuss</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Drawing basic 2D shapes on a canvas.</title>
      <dc:creator>Allison Assifuah</dc:creator>
      <pubDate>Fri, 19 May 2023 17:48:15 +0000</pubDate>
      <link>https://dev.to/_aaallison/drawing-basic-2d-shapes-on-a-canvas-44md</link>
      <guid>https://dev.to/_aaallison/drawing-basic-2d-shapes-on-a-canvas-44md</guid>
      <description>&lt;p&gt;&lt;strong&gt;Table of content:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction

&lt;ul&gt;
&lt;li&gt;Do's and don'ts&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Primitive Shapes

&lt;ul&gt;
&lt;li&gt;Rectangles&lt;/li&gt;
&lt;li&gt;Paths&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a id="item-one"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello 👋, Welcome back. In our previous article, we discussed what 2D shapes are, what a canvas is, and how to use coordinates on a canvas.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will be drawing basic shapes. We will work on improving our understanding of drawing shapes on our canvas.&lt;/p&gt;

&lt;p&gt;Before we begin drawing, there are a few things you should know about using a canvas.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-two"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;do's&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remember to always close your canvas with the &lt;code&gt;&amp;lt;/canvas&amp;gt;&lt;/code&gt; tag.&lt;/li&gt;
&lt;li&gt;Sketch what you want to draw on a piece of paper so you will know where to put your coordinates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;don'ts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The size of the shape you're drawing should be no larger than the size of your canvas. If your object is larger than your canvas, the area that the canvas cannot contain will not be shown. 
The diagram below shows what happens when the canvas is smaller than the drawing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jd0_9zFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n82qqufbypuc5uh38nc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jd0_9zFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n82qqufbypuc5uh38nc6.png" alt="error" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CfFtc2Ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5srnukxsewu9zak849d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CfFtc2Ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5srnukxsewu9zak849d.png" alt="result" width="570" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a id="item-three"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Primitive shapes.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; supports only two primitive shapes: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rectangles and &lt;/li&gt;
&lt;li&gt;paths (lists of points connected by lines). 
All other shapes are created by combining one or more paths.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id="item-four"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Drawing a rectangle.
&lt;/h3&gt;

&lt;p&gt;Because a rectangle is a primitive shape on canvas, it has its own set of drawing methods. There are three functions on the canvas that draw rectangles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;fillRect(x, y, width, height). This method creates a filled rectangle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;strokeRect(x, y, width, height). This creates the rectangle's outline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;clearRect(x, y, width, height). Clears the chosen rectangular region, making it transparent.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These three functions all use the same parameters. x and y define the top-left corner of the rectangle's position on the canvas (relative to the origin). The width and height define the size of the rectangle.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wmitzG9z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asrxwb6w1vazxvcttwn3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wmitzG9z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asrxwb6w1vazxvcttwn3.png" alt="html" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our script file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jNAjOkqn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2gvx4ovjpzzqhmz4jlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jNAjOkqn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2gvx4ovjpzzqhmz4jlf.png" alt="script" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a id="item-five"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Drawing other shapes (using Paths).
&lt;/h3&gt;

&lt;p&gt;In contrast to the rectangle, every other shape must be created by joining one or more paths. A path, as we know, is a list of points connected by lines.&lt;/p&gt;

&lt;p&gt;Let's draw a line to see what a path is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KubU3u22--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lmw6mn04mf58blk0215.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KubU3u22--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lmw6mn04mf58blk0215.png" alt="line" width="800" height="296"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RumjLVHU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndv3ndj90irp4uypktjv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RumjLVHU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndv3ndj90irp4uypktjv.png" alt="line" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A point, as shown in the diagrams above, is made up of an x and y coordinate. A path is formed by connecting these points with a line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;another example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DQmnVtrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0i6c29dui222thbf6gk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DQmnVtrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0i6c29dui222thbf6gk.png" alt="line2" width="800" height="302"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RnRSkL33--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gf3ka33yesye7nb9fu8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RnRSkL33--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gf3ka33yesye7nb9fu8i.png" alt="line2" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From our codes above, we noticed new methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;beginPath()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;lineTo()&lt;/strong&gt;
and &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stroke()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;beginPath()&lt;/strong&gt; Makes a new path. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;lineTo()&lt;/strong&gt; Adds a new point to the canvas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;stroke()&lt;/strong&gt; Draws the shape by tracing its outline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shape 1: a triangle
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L7s3FZkq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzsd800pxxcauluxsqwp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L7s3FZkq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzsd800pxxcauluxsqwp.png" alt="triangle" width="800" height="497"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dc8ROtkK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iea8hk86mit2ddu1vik4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dc8ROtkK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iea8hk86mit2ddu1vik4.png" alt="triangle" width="502" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Shape 2: an arrow
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vpaMW-9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0uxr9dwu3geh3js7t6ae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vpaMW-9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0uxr9dwu3geh3js7t6ae.png" alt="arrow" width="800" height="608"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ri4m6LPh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yagw9n4owh4jpmfkb1wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ri4m6LPh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yagw9n4owh4jpmfkb1wc.png" alt="arrow" width="472" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Shape 3: a star
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bKhrKW9Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmdnr3nnxz5374tp203q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bKhrKW9Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmdnr3nnxz5374tp203q.png" alt="star" width="800" height="721"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NDDgQHcw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jltqm51z4i86azxjig9z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NDDgQHcw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jltqm51z4i86azxjig9z.png" alt="star" width="466" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;At the end of this tutorial, we learned how to draw some simple shapes. In our next tutorial, we'll look at adding color to our forms to make them more dynamic.&lt;br&gt;
Please leave a comment with an image of a shape you created on your canvas.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Recognizing 2D shapes and how to draw them on a canvas.</title>
      <dc:creator>Allison Assifuah</dc:creator>
      <pubDate>Thu, 18 May 2023 09:18:44 +0000</pubDate>
      <link>https://dev.to/_aaallison/recognizing-2d-shapes-and-how-to-draw-them-on-a-canvas-i6k</link>
      <guid>https://dev.to/_aaallison/recognizing-2d-shapes-and-how-to-draw-them-on-a-canvas-i6k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Table of content:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
Understanding what a 2D shape is.

&lt;ul&gt;
&lt;li&gt;What is a dimension?&lt;/li&gt;
&lt;li&gt;What then is a 2D?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
How do we use programming to draw 2D shapes?

&lt;ul&gt;
&lt;li&gt;What is a Canvas?&lt;/li&gt;
&lt;li&gt;The syntax for using the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Drawing on the canvas&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a id="item-one"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding what a 2D shape is.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;2D&lt;/strong&gt; is a compound term made up of two words: (&lt;strong&gt;2&lt;/strong&gt; and &lt;strong&gt;dimensions&lt;/strong&gt;).&lt;br&gt;
We all know the number 2. &lt;/p&gt;

&lt;p&gt;&lt;a id="item-two"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a dimension?
&lt;/h3&gt;

&lt;p&gt;A dimension is the measurement of distance in a specific direction.&lt;br&gt;
Think of a straight line. You can move from point a(left) to point b(right), and then back to point a(left). Because you can only move along that line, it is referred to as a first dimension (1D).&lt;/p&gt;

&lt;p&gt;&lt;a id="item-three"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What then is a 2D?
&lt;/h3&gt;

&lt;p&gt;2D stands for two dimensions, as the name implies. This means that in addition to moving left and right in the first dimension (1D), you may now move up and down. There are two ways in 2D: left-right (horizontal) and up-down (vertical).&lt;/p&gt;

&lt;p&gt;The point from left to right will be labeled width, and the point from top to bottom will be labeled height. Triangles, rectangles, squares, and circles are examples of 2D shapes.&lt;/p&gt;

&lt;p&gt;A 2-dimensional shape is defined as any shape with only two dimensions: height and width.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-four"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do we use programming to draw 2D shapes?
&lt;/h2&gt;

&lt;p&gt;That is where the concept of a canvas comes into play.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-five"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Canvas?
&lt;/h3&gt;

&lt;p&gt;A canvas is a digital surface used in online graphics. A canvas is used to create anything from simple shapes to complex animations. We use the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element provided by HTML to draw graphics in the web browser. &lt;/p&gt;

&lt;p&gt;The HTML &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element is used for drawing graphics in a web browser. The &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element provides a drawing surface — a container for graphics. To draw on the canvas, we must use a script. &lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element is not difficult. However, you do need a basic understanding of HTML and Javascript. &lt;/p&gt;

&lt;p&gt;A &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; has a default size of 300 x 150 pixels (width x height). Fortunately, the HTML height and width properties allow you to change the sizes. It is preferable to set the width and height attributes on the html tag rather than using CSS. This is due to the possibility of CSS distorting the form.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-six"&gt;&lt;/a&gt;&lt;br&gt;
 &lt;strong&gt;The syntax for using the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ww7Y-N82--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ieqggf0qxjq69ziz096p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ww7Y-N82--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ieqggf0qxjq69ziz096p.png" alt="html" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element in our HTML file looks like the diagram above.&lt;/p&gt;

&lt;p&gt;Three key characteristics are required for the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element to work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a width attribute.&lt;/li&gt;
&lt;li&gt;a height attribute.&lt;/li&gt;
&lt;li&gt;a unique identifier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When not defined, the width and height attributes will be set to the default width and height. The unique identifier (id) helps us to identify the canvas element in our script since the drawing will be done with javascript.&lt;/p&gt;

&lt;p&gt;All drawings on the canvas must be done with Javascript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ERkOdt-F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvb6lf35c2gg0maaxpjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ERkOdt-F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvb6lf35c2gg0maaxpjg.png" alt="script" width="754" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The syntax of our Javascript or script file looks like the diagram above.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first line of code in our script uses the document.getElementById() function to locate the '' element. Once we have the element node, we can use its getContext() method to get the drawing context.&lt;/p&gt;

&lt;p&gt;getContext() is a built-in HTML object with many drawing methods and properties. The getContext() object takes one parameter: the type of context. We specify "2D" because we are dealing with 2D shapes.&lt;/p&gt;

&lt;p&gt;&lt;a id="item-seven"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Drawing on a canvas
&lt;/h2&gt;

&lt;p&gt;Now that we've set up our canvas environment, we can start drawing on it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What area of the canvas should we begin drawing on?&lt;/strong&gt;&lt;br&gt;
A grid structure is used in the HTML canvas. A two-&lt;br&gt;
The HTML canvas has a grid system. The canvas is a two-dimensional grid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iRsJQXQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzrjjayenqnln7rkaboj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iRsJQXQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzrjjayenqnln7rkaboj.png" alt="grid" width="220" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, all drawings on the canvas begin in the upper-left corner, which corresponds to the coordinates (0,0). The first number is the x-axis coordinate, and the second number is the y-axis coordinate. &lt;/p&gt;

&lt;p&gt;The x and y axis are made up of values ranging from 0 to the number you choose for the canvas's height and width.&lt;br&gt;
To better understand how the grid works, let’s draw a rectangle on the canvas grid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SVN1s-Eh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pfwo0dtq8yfdige5ll6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SVN1s-Eh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pfwo0dtq8yfdige5ll6.png" alt="html" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LSejf2f9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rv3kp0b5up4viuhbc260.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LSejf2f9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rv3kp0b5up4viuhbc260.png" alt="script" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pHZIw-Rd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6itn7plaiuctbdadvs0o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pHZIw-Rd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6itn7plaiuctbdadvs0o.png" alt="result" width="526" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the example above, I added a border(color: red) to the canvas to distinguish the HTML canvas from the 2D shape we will be drawing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iiGebTwe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgz4cugweutf60jtnhwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iiGebTwe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgz4cugweutf60jtnhwy.png" alt="stroke" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The rectangle has four numbers. The first (50) represents the x-axis, while the second (also 50) represents the y-axis. This implies that we moved 50 pixels away from the origin on the x-axis and 50 pixels away from the origin on the y-axis.&lt;/p&gt;

&lt;p&gt;Congratulations!! Since we now understand how the canvas grid works, we'll look at the do's and don'ts of drawing on a canvas as well as how to draw more forms in our next tutorial.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Dear Beginner, it gets better.</title>
      <dc:creator>Allison Assifuah</dc:creator>
      <pubDate>Thu, 04 May 2023 01:50:20 +0000</pubDate>
      <link>https://dev.to/_aaallison/dear-beginner-it-gets-better-1303</link>
      <guid>https://dev.to/_aaallison/dear-beginner-it-gets-better-1303</guid>
      <description>&lt;p&gt;Remember when you first got introduced to the world of programming? Beaming with so much excitement and eagerness, you imagined all the incredible things you could build. And with little to no illusions about how difficult it might get, you picked a field and started learning away. Now here you are, stuck! You start to think this is above what your mind can process or achieve. Well, you are not alone.&lt;/p&gt;

&lt;p&gt;Just like every other discipline, everyone who began programming has and most often keeps experiencing difficulties with making their ideas come to life. What you do when you face obstacles will define how &lt;br&gt;
much you will enjoy the journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to do whenever you feel stuck or face difficulties along the way.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Find the intrigue in the exasperating. Curiosity in this discipline is everything. Putting in the effort to find out why something isn't working or behaving as you please makes a huge difference. You may have followed a tutorial, code after code and yet still, your code may not work as the one shown in the tutorial. Jump on Google or any search engine of your choice to find answers. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programming can be overwhelming especially if you are doing it alone. Communities act as a support network.&lt;br&gt;
Support and motivation are usually the key attributes every community possesses. Join communities or create one where everyone shares the same interest in technology, and eagerness to learn, grow, improve, and help each other.  Being a part of such communities makes you realize most of the mistakes or roadblocks you are experiencing in your journey are common and not just pertaining to only you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ask for help. You may find it hard, embarrassing even if you are not used to asking for help. Fortunately, most people in the programming field are always willing to help. You can start by private messaging people in your field you think may help and sharing the problem you are facing in your learning group. And with time, you will get comfortable with asking for help.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Share what you are learning. When you share what you are learning and building, it opens you up to criticism. Flaws you may have not noticed will be pointed out to you by others. Suggestions will be made and all these help you improve.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The path to becoming a software engineer takes a varying mixture of grit, community support, and optimism. Enjoy your journey. Cheers&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
