<?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: mcardona9015</title>
    <description>The latest articles on DEV Community by mcardona9015 (@mcardona9015).</description>
    <link>https://dev.to/mcardona9015</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%2F568799%2Fc96d8fa7-a04f-4bab-a9d4-22cfee58df94.jpeg</url>
      <title>DEV Community: mcardona9015</title>
      <link>https://dev.to/mcardona9015</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mcardona9015"/>
    <language>en</language>
    <item>
      <title>A Blog about Blogs</title>
      <dc:creator>mcardona9015</dc:creator>
      <pubDate>Thu, 25 Mar 2021 16:55:19 +0000</pubDate>
      <link>https://dev.to/mcardona9015/a-blog-about-blogs-2ng0</link>
      <guid>https://dev.to/mcardona9015/a-blog-about-blogs-2ng0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Blogs, blogs, blogs&lt;/strong&gt;. It seems like everyone in the tech world is always talking about them, sharing them, telling you to write them. Are they worth the effort and what are the benefits of them?&lt;/p&gt;

&lt;h3&gt;
  
  
  The Struggle
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oOtXoE2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxoiwu22oc6t4kqip4ii.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oOtXoE2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxoiwu22oc6t4kqip4ii.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
As a current software development bootcamp student I was surprised to learn that writing at least four or more blog posts was a mandatory part of the curriculum in order to graduate. When I first started I couldn't understand why I was required to take time out of my busy schedule to write what I considered to be a glorified diary post and share it publicly on the internet for anyone to see. I started this bootcamp to learn programming, not to dredge up my English essay writing skills. As the deadline approached for the blog presentation I began dreading the thought of writing the blog, I was filled with anxiety about choosing a topic for the post, and I was worried I would be judged on my lack of experience about the topic. Why should I, who has been studying programming for such a short amount of time be writing a public post about it that anyone can see?&lt;/p&gt;

&lt;p&gt;As I began to write my first post and read the posts that were shared by my fellow programmers-to-be I started to see the benefits of the humble blog in the tech world. The three major upsides of blog posts that I've found are the sharing of knowledge, learning through teaching, and preparing for the professional world. &lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing of knowledge
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_bZBJUzJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/is557afw346qbbuow552.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_bZBJUzJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/is557afw346qbbuow552.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
We've all been there; staring at a jumbled mess of code, banging our heads against the keyboard, desperate for someone to help us figure out how to tackle the latest problem we've run into. Our first instinct as the esteemed programmers we are is to turn to Google, after all most problems that exist have already been tackled. There is a good chance that one of the first results that will come up is going to be a blog post by a fellow programmer who once upon a time was in a similar situation and decided to share their knowledge on the solution. In a way it is comforting to know that we are not alone in our struggle and there was and will be again someone else facing the same issues you face. So when you next make your big break through consider writing a blog about it to help out the next person with keys plastered to their forehead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning through Teaching
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OhUzVbFw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwsc5ghjdhcufctd8zg0.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OhUzVbFw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwsc5ghjdhcufctd8zg0.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
I've found that one of the best ways to solidify your knowledge on a topic is to try to explain it to someone else. Teaching forces you to really examine a subject in depth and think about it from different angles. Being able to explain a topic also helps to build confidence in your abilities; if you are confident enough to teach someone about a subject then you are confident enough to apply those skills to your own personal projects. Writing blog posts is a great way to grow your skills as a teacher, and in turn improve your own self-efficacy as a programmer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing for the professional world
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zAI9N3_K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xymbe6iqkg6ks8ncp9fn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zAI9N3_K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xymbe6iqkg6ks8ncp9fn.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
In this day and age of zoom interviews, remote work, and slack meetings, our professional personas live more and more on the internet. There are many facets to this, whether it is your LinkedIn page, portfolio, personal website or social media feed, your potential employer will likely get their first impression of you from somewhere on the internet. Posting technical blogs on the subjects you will likely be utilizing in your work will not only show a degree of skill in the field, but will also show you have the confidence and know-how to put into practice what you've been learning. Regularly posting blogs will allow your fellow professionals to see you are active in the field and allow them to get a taste of your personality without ever need to meet face-to-face. Having an online presence is more important than ever in the professional world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tEOXkI3P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdohbpqe90z8wbuihsvz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tEOXkI3P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdohbpqe90z8wbuihsvz.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
As daunting as it may seem at first to put yourself out there on the internet in yet another form, I hope this blog post about blog posts has shown the benefits of writing blogs and encouraged my fellow lurkers to take the plunge and make their mark on this community. And next time you turn to a blog post for guidance, make sure to show your thanks to the writer with a comment or follow.&lt;/p&gt;

</description>
      <category>blog</category>
      <category>programming</category>
      <category>writing</category>
      <category>productivity</category>
    </item>
    <item>
      <title>CSS Grid Introduction</title>
      <dc:creator>mcardona9015</dc:creator>
      <pubDate>Thu, 11 Mar 2021 05:01:38 +0000</pubDate>
      <link>https://dev.to/mcardona9015/css-grid-introduction-1gpi</link>
      <guid>https://dev.to/mcardona9015/css-grid-introduction-1gpi</guid>
      <description>&lt;h1&gt;
  
  
  CSS GRID
&lt;/h1&gt;

&lt;p&gt;There are many ways to style your website, and today I'm going to give a brief introduction to styling using CSS Grid layout. CSS grid provides you with a modular and dynamic way to layout your website. We'll start with a simple 3 x 3 grid example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Codepen Example&lt;/strong&gt;&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/mcardona9015/embed/BaQvLmj?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started with &lt;code&gt;display: grid;&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The first thing you need to do to get started with CSS grid is to select the element you would like to turn into a grid and give it a display property of &lt;code&gt;display: grid;&lt;/code&gt;. This will be the parent element, which you can think of as the outer container of the grid. All of its child elements can then be placed in the columns and rows you define within the grid.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;grid-template-columns&lt;/code&gt; and &lt;code&gt;grid-template-rows&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The next step is to define how many rows and column you would like to give your grid and what size they should be. A common choice for size is to use &lt;code&gt;fr&lt;/code&gt;, a fractional unit which represents a fraction of the available space in the grid container.&lt;/p&gt;

&lt;p&gt;For the columns we will give the container a property of &lt;code&gt;grid-template-columns&lt;/code&gt; and then specify the size of the column using &lt;code&gt;fr&lt;/code&gt;. A column will be created for each size declared. If we wanted three columns, with the middle column taking up half the space, we would set the property as &lt;code&gt;grid-template-columns: 1fr 2fr 1fr;&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;We can specify the rows in a similar fashion using &lt;code&gt;grid-template-rows&lt;/code&gt;. If we wanted three identically sized rows we could specify the row size to repeat three times at the size of &lt;code&gt;1fr&lt;/code&gt; using &lt;code&gt;repeat()&lt;/code&gt; notation like so: &lt;code&gt;grid-template-rows: repeat(3, 1fr);&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;grid-column&lt;/code&gt; and &lt;code&gt;grid-row&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we have our grid container set up we can place its child elements anywhere we specify in the grid using the &lt;code&gt;grid-column&lt;/code&gt; and &lt;code&gt;grid-row&lt;/code&gt; properties. &lt;/p&gt;

&lt;p&gt;In our 3 x 3 grid example if we wanted to place a specific child element in the center of the grid at column two - row two we would select the element in our css and give it properties of:&lt;br&gt;
  &lt;code&gt;grid-row: 2;&lt;/code&gt;&lt;br&gt;
  &lt;code&gt;grid-column: 2;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Grids within grids
&lt;/h2&gt;

&lt;p&gt;Child elements of grids can also be grids themselves. It is possible to have multiple layers of grids, each with their own specific column and row sizes. Another use case for giving child elements the &lt;code&gt;display: grid;&lt;/code&gt; property is to gain access to the place-items property. This is a handy shortcut for aligning and justifying an elements content in one line. using&lt;br&gt;
&lt;code&gt;place-items: center;&lt;/code&gt;&lt;br&gt;
will center any items within that grid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;There are many, many other use cases and properties for CSS Grid Layout, but if you know the basics laid out above then you are on your way to creating orderly, dynamic websites! You can checkout more about CSS Grid at the MDN docs &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>grid</category>
      <category>cssgrid</category>
    </item>
    <item>
      <title>Create a Simple Sprite Animation with CSS</title>
      <dc:creator>mcardona9015</dc:creator>
      <pubDate>Tue, 16 Feb 2021 06:29:32 +0000</pubDate>
      <link>https://dev.to/mcardona9015/create-a-simple-sprite-animation-with-css-35a0</link>
      <guid>https://dev.to/mcardona9015/create-a-simple-sprite-animation-with-css-35a0</guid>
      <description>&lt;p&gt;In order to create a simple sprite animation using nothing but HTML and CSS you will need to start with a sprite sheet of the sprite you would like to animate. You can either find resources online for free or paid sprite sheets, or create your own. &lt;a href="https://www.piskelapp.com/" rel="noopener noreferrer"&gt;Piskelapp&lt;/a&gt; is a handy website that allows you to create multiple frames of pixel art and import them as a single sprite sheet. &lt;/p&gt;

&lt;p&gt;For demonstration purposes I created a simple character walking animation using Pixelapp and imported it in a 4x1 frame.(Please don't judge the terrible pixel art, I'm studying to be a programmer, not an artist!)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ylcuzq40uahw9ny2j6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ylcuzq40uahw9ny2j6y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It takes just a few tricky lines of CSS in order to turn this &lt;em&gt;static sprite sheet&lt;/em&gt; into this &lt;em&gt;animated sprite&lt;/em&gt;:&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczls30vwei5evhhzsd5h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczls30vwei5evhhzsd5h.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  HTML
&lt;/h3&gt;

&lt;p&gt;To start we'll need some boilerplate &lt;code&gt;HTML&lt;/code&gt; with a &lt;code&gt;div&lt;/code&gt; in the &lt;code&gt;body&lt;/code&gt;. We'll give that &lt;code&gt;div&lt;/code&gt; a class of &lt;code&gt;character&lt;/code&gt;.  Within that &lt;code&gt;div&lt;/code&gt; will be our sprite sheet &lt;code&gt;img&lt;/code&gt; with a class of &lt;code&gt;character-spritesheet&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Sprite Animation&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"character"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; 
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"character-spritesheet"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"sample_sprite_sheet_large.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Character"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;       
     &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's all we'll need for the HTML!&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS
&lt;/h3&gt;

&lt;p&gt;In order to create the illusion of movement for our animation we will need to cycle through each frame of the sprite sheet in quick succession while having only one frame visible at a time. &lt;/p&gt;

&lt;p&gt;The key to accomplishing this lies in creating a keyframe animation on the &lt;code&gt;.character-spritesheet&lt;/code&gt; using &lt;code&gt;transform: translate&lt;/code&gt;, while applying &lt;code&gt;overflow: hidden&lt;/code&gt; to the container &lt;code&gt;div&lt;/code&gt; &lt;code&gt;.character&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Applying &lt;code&gt;transform: translate&lt;/code&gt; to an image will make the image move across itself in the specified x and y axis. We want the image to start at the x position of 0 and move across itself 100%, so we create the &lt;code&gt;@keyframes&lt;/code&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;moveSpritesheet&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nt"&gt;from&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we apply the animation to the &lt;code&gt;.character-spritesheet&lt;/code&gt;, setting the speed we want to it to move, how many frames there are, and how long we want the animation to move:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt; &lt;span class="nc"&gt;.character-spritesheet&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;moveSpritesheet&lt;/span&gt; &lt;span class="m"&gt;1s&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final key step to create the animation is to set the container &lt;code&gt;.character&lt;/code&gt; &lt;code&gt;div&lt;/code&gt;'s height and width to match the size size of one frame of you animation(in our case '320px'), and to set &lt;code&gt;overflow: hidden&lt;/code&gt;. Setting &lt;code&gt;overflow&lt;/code&gt; to &lt;code&gt;hidden&lt;/code&gt; is the key to the illusion of the animation; it tell the &lt;code&gt;div&lt;/code&gt; to hide any part of an element within it that goes beyod the &lt;code&gt;div&lt;/code&gt;'s width and height. Since we set the &lt;code&gt;.character&lt;/code&gt; &lt;code&gt;div&lt;/code&gt;'s size to be equal to only one frame of the animation, as the animation takes place all of the other frames will be hidden from view, creating the illusion of movement!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.character&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;320px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;320px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.piskelapp.com/" rel="noopener noreferrer"&gt;piskelapp.com&lt;/a&gt; - Pixel Art Creation Tool&lt;br&gt;
&lt;a href="https://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp" rel="noopener noreferrer"&gt;CSS @keyframes&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate()" rel="noopener noreferrer"&gt;CSS transform: translate&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/css/css_positioning.asp" rel="noopener noreferrer"&gt;CSS position&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Video&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/channel/UCvQwAK9oAYXM0RMucLy2-BA" rel="noopener noreferrer"&gt;Drew Conley&lt;/a&gt; has a great YouTube video where he walks through this process in much greater detail. It is worth a watch if you are interested in game design using purely HTML, CSS, and JavaScript.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ekI7vjkFrGA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Full Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Sprite Animation&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"character"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; 
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"character-spritesheet"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"sample_sprite_sheet_large.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Character"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;       
     &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
         &lt;span class="nc"&gt;.character&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;320px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;320px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="nc"&gt;.character-spritesheet&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;moveSpritesheet&lt;/span&gt; &lt;span class="m"&gt;1s&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;moveSpritesheet&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nt"&gt;from&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nt"&gt;to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>html</category>
      <category>animation</category>
      <category>sprite</category>
    </item>
    <item>
      <title>Active Record Callbacks Introduction</title>
      <dc:creator>mcardona9015</dc:creator>
      <pubDate>Thu, 28 Jan 2021 14:31:38 +0000</pubDate>
      <link>https://dev.to/mcardona9015/active-record-callbacks-introduction-5a7</link>
      <guid>https://dev.to/mcardona9015/active-record-callbacks-introduction-5a7</guid>
      <description>&lt;p&gt;All objects created in a rails application have a life cycle, which consists of three general stages: &lt;strong&gt;Create&lt;/strong&gt;, &lt;strong&gt;Update&lt;/strong&gt;, and &lt;strong&gt;Destroy&lt;/strong&gt;. Callbacks allow you to trigger designated methods before, during, or after each stage of an objects life cycle.&lt;/p&gt;

&lt;p&gt;Below I will go over some of the basics of an objects lifecycle, as well as a few callback methods and the order in which they will be called.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Create&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While this one method may seem to only be creating a new object and saving it to the database, there are actually many steps taking place under the hood to achieve this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Before the object is created it needs to pass its validations.&lt;/li&gt;
&lt;li&gt;After the object is validated it is given the okay to be created.&lt;/li&gt;
&lt;li&gt;After creation the item is finally saved to the database&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before, during, and after each of these steps takes places we are able to utilize callback methods to perform actions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Callback methods for Create
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;before_validation &lt;/li&gt;
&lt;li&gt;after_validation&lt;/li&gt;
&lt;li&gt;before_save&lt;/li&gt;
&lt;li&gt;before_create&lt;/li&gt;
&lt;li&gt;after_create&lt;/li&gt;
&lt;li&gt;after_save&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In order to demonstrate the order the above callbacks are called in we can define a simple user model with a method that &lt;code&gt;puts&lt;/code&gt; out the name of each callback.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationRecord&lt;/span&gt;

    &lt;span class="n"&gt;before_validation&lt;/span&gt; &lt;span class="ss"&gt;:bv&lt;/span&gt;
    &lt;span class="n"&gt;after_validation&lt;/span&gt; &lt;span class="ss"&gt;:av&lt;/span&gt;
    &lt;span class="n"&gt;before_save&lt;/span&gt; &lt;span class="ss"&gt;:bs&lt;/span&gt;
    &lt;span class="n"&gt;before_create&lt;/span&gt; &lt;span class="ss"&gt;:bc&lt;/span&gt;
    &lt;span class="n"&gt;after_create&lt;/span&gt; &lt;span class="ss"&gt;:ac&lt;/span&gt;
    &lt;span class="n"&gt;after_save&lt;/span&gt; &lt;span class="ss"&gt;:as&lt;/span&gt;
    &lt;span class="n"&gt;after_commit&lt;/span&gt; &lt;span class="ss"&gt;:a_com&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bv&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"before_validation"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;av&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"after_validation"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bs&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"before_save"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bc&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"before_create"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ac&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"after_create"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;as&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"after_save"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we create an instance of the user model we can see in the console the order in which the methods are being called as the item is created and then saved to the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft5rmjsfnituqt5unc2kp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft5rmjsfnituqt5unc2kp.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Update&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Callback methods for Update
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;before_validation &lt;/li&gt;
&lt;li&gt;after_validation&lt;/li&gt;
&lt;li&gt;before_save&lt;/li&gt;
&lt;li&gt;before_update&lt;/li&gt;
&lt;li&gt;after_update&lt;/li&gt;
&lt;li&gt;after_save&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Callback methods for Update behave very similarly to the create callbacks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Note: &lt;code&gt;after_save&lt;/code&gt; runs both on create and update, but always after the more specific callbacks &lt;code&gt;after_create&lt;/code&gt; and &lt;code&gt;after_update&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Destroy&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Callback methods for Destroy
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;before_destroy&lt;/li&gt;
&lt;li&gt;after_destroy&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;There are many uses for callbacks, which are covered in greater detail at the Ruby on Rails &lt;a href="https://guides.rubyonrails.org/active_record_callbacks.html" rel="noopener noreferrer"&gt;guide&lt;/a&gt;.&lt;br&gt;
I encourage anyone creating a Rails project to look into them further and utilize there powerful features!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>activerecord</category>
      <category>callbacks</category>
      <category>lifecycle</category>
    </item>
  </channel>
</rss>
