<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Katherine Kato on Medium]]></title>
        <description><![CDATA[Stories by Katherine Kato on Medium]]></description>
        <link>https://medium.com/@kathykato?source=rss-51957683d04f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VvqYZ_ra1THOq0rTz9i84g.png</url>
            <title>Stories by Katherine Kato on Medium</title>
            <link>https://medium.com/@kathykato?source=rss-51957683d04f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 11:22:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kathykato/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Reveal Effects on Scroll]]></title>
            <link>https://medium.com/@kathykato/creating-reveal-effects-on-scroll-9cb04b39c9a5?source=rss-51957683d04f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cb04b39c9a5</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Katherine Kato]]></dc:creator>
            <pubDate>Wed, 27 Feb 2019 18:25:52 GMT</pubDate>
            <atom:updated>2019-02-27T18:25:52.421Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial I would like to share on how I create block reveal effects on scroll. The effect consists of solid colored block decreasing in size and revealing text or an image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qtCaJ3SscNBGVuKEHfl7Rw.gif" /></figure><p>These reveal effects can be used to create engaging and fresh interactions for UI components such as image sliders. I created this slider using a similar wipe animation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*INoE--P2UJpY1GjQKWLTGA.gif" /><figcaption>View it on <a href="https://codepen.io/kathykato/pen/MqYVOq">CodePen</a>.</figcaption></figure><p>I will be showing you how to create this effect with CSS and <a href="https://michalsnik.github.io/aos/">Animate on Scroll (AOS)</a>, a JavaScript library for animating elements on scroll as a user enters the viewport.</p><h3>Getting started</h3><p>Let’s begin by adding the Animate on Scroll library to the project. Include the aos.css in &lt;head&gt; tag:</p><pre>&lt;link href=”https://unpkg.com/aos@2.3.1/dist/aos.css&quot; rel=”stylesheet”&gt;</pre><p>And aos.js before the closing &lt;body&gt; tag:</p><pre>&lt;script src=&quot;<a href="https://unpkg.com/aos@2.3.1/dist/aos.js">https://unpkg.com/aos@2.3.1/dist/aos.js</a>&quot;&gt;&lt;/script&gt;</pre><p>Once added, initialize AOS:</p><pre>AOS.init();</pre><h3>Creating the reveal block</h3><p>First we will create the reveal block for revealing text underneath. We will be grabbing text from <a href="https://doggoipsum.com/">Doggo Ipsum</a>, a lorem ipsum generator from doggo lingo.</p><pre>&lt;div class=&quot;reveal-holder&quot;&gt;<br>  &lt;div class=&quot;reveal-block&quot;&gt;&lt;/div&gt;<br>  &lt;h1 class=&quot;heading&quot;&gt;Maximum borkdrive&lt;/h1&gt;<br>&lt;/div&gt;</pre><p>The .reveal-holder class is a container for the solid color block element and text. The styling for these classes are:</p><pre>.reveal-holder {<br>  position: relative;<br>  display: inline-block;<br>  overflow: hidden;<br>}</pre><pre>.reveal-block {<br>  position: absolute;<br>  top: 0;<br>  width: 100%;<br>  height: 101%;<br>  background: white;<br>}</pre><p>This is for the block to cover and reveal an element properly. Having the height of the .reveal-block class to 101% is important here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*JgaHsfNczGaCw8fosFeuQQ.png" /><figcaption>Setting the height to 100% results in the reveal block not completely over images after window resizing.</figcaption></figure><p>Having the overflow CSS property set to hidden for the .reveal-holder class helps prevent anything outside the element’s content from clipping.</p><h3>Using CSS transitions</h3><p>Animations are set using the data-aos attribute. For example, to reveal an element from the right, add the attribute to the .reveal-block class in the HTML:</p><pre>&lt;div class=&quot;reveal-block&quot; data-aos=&quot;reveal-right&quot;&gt;&lt;/div&gt;</pre><p>And CSS:</p><pre>[data-aos=&quot;reveal-right&quot;] {<br>  transform: scaleX(1);<br>  transform-origin: 100% 0%;<br>  transition-property: transform;<br>  transition-delay: 0.5s;<br>}</pre><pre>[data-aos=&quot;reveal-right&quot;].aos-animate {<br>  transform: scaleX(0);<br>}</pre><p>The transform CSS property is using the scaleX() function to the .reveal-block element in order for the block to resize when animated. The transform-origin property sets the point of the transformation, which in this case is at 100% 0% or right left. This is what causes the block to animate by decreasing in size. The transition-property sets the transition effect to be applied and transition-delay sets the transition to wait based on the value set.</p><p>Add these options to the AOS.init() function to make the animation play once:</p><pre>AOS.init({<br>  once: true<br>});</pre><p>The animations will now play once on scroll! Here is how it should look so far:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*IcDhh0rDvRCFKuyqviWONg.gif" /></figure><p>To add this same effect to images, it is a similar process. Replace the text with an image in HTML:</p><pre>&lt;div class=&quot;reveal-holder&quot;&gt;<br>  &lt;div class=&quot;reveal-block&quot; data-aos=&quot;reveal-left&quot;&gt;&lt;/div&gt;<br>  &lt;img src=&quot;pomeranian.jpg&quot; alt=&quot;Pomeranian&quot;&gt;<br>&lt;/div&gt;</pre><p>To make the reveal effect slide to the left from the right, edit the transform-origin to 0% 100%:</p><pre>[data-aos=&quot;reveal-left&quot;] {<br>  ...<br>  transform-origin: 0% 100%;<br>  ...<br>}</pre><h3>Animating pseudo-elements</h3><p>We will be using pseudo-elements to the .reveal-block class to create a more stylish reveal animation.</p><p>Start by modifying the CSS for the .reveal-block class:</p><pre>.reveal-block {<br>  position: absolute;<br>  top: 0;<br>  width: 100%;<br>  height: 101%;<br>  background: white;<br>}</pre><pre>.reveal-block::before {<br>  position: absolute;<br>  content: &#39;&#39;;<br>  top: 0;<br>  left: 0;<br>  right: 0;<br>  bottom: 0;<br>  background: lightgray;<br>  transition-property: transform;<br>  transition-duration: 0.5s;<br>}</pre><p>The ::before pseudo-element is its own element, acting like another .reveal-block but can be set with its own properties, such as background color or positioning.</p><p>Add a .right class to .reveal-block like so:</p><pre>&lt;div class=&quot;reveal-block right&quot; data-aos=&quot;reveal-right&quot;&gt;&lt;/div&gt;</pre><p>This will help when with animating with pseudo-elements. The CSS being:</p><pre>.reveal-block.right::before {<br>  transform: scaleX(0);<br>  transform-origin: 0% 100%;<br>}</pre><pre>.reveal-block.right.aos-animate::before {<br>  transform: scaleX(1);<br>}</pre><p>This is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*whuB-0_MhBnISCqiM_1Uww.gif" /></figure><p>Looks great! All that is left is to hide elements from appearing before scroll. To do this, we will add an data-aos attribute to the .reveal-holder class:</p><pre>&lt;div class=&quot;reveal-holder&quot; data-aos=&quot;reveal-item&quot;&gt;...&lt;/div&gt;</pre><p>And the accompanying CSS:</p><pre>[data-aos=&quot;reveal-item&quot;] {<br>  visibility: hidden;<br>  transition-property: visibility;<br>  transition-duration: 0s;<br>}</pre><pre>[data-aos=&quot;reveal-item&quot;].aos-animate {<br>  visibility: visible;<br>}</pre><h3>Wrapping up</h3><p>Scroll-triggered animations such as block reveal effects can be an immersive and elegant interaction to reveal content. I hope this tutorial helped you learn not only how these animations are done, but also understanding what is exactly happening to make this animation work.</p><p>A live demo is available on <a href="https://codepen.io/kathykato/pen/PLwBez">CodePen</a>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fkathykato%2Fembed%2Fpreview%2FPLwBez%3Fheight%3D600%26slug-hash%3DPLwBez%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fkathykato%2Fpen%2FPLwBez&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1159990.PLwBez.small.ca2db01d-d091-44d0-b758-0d9c79562b57.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c271fe2f45dc5a2d06b6c982a4bcb46/href">https://medium.com/media/9c271fe2f45dc5a2d06b6c982a4bcb46/href</a></iframe><p>I also created a <a href="https://github.com/kathykato/reveal-effects">GitHub repository</a> with the code.</p><p><a href="https://github.com/kathykato/reveal-effects">kathykato/reveal-effects</a></p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cb04b39c9a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an animated logo with SVG and CSS animations]]></title>
            <link>https://medium.com/fullstack-digital/how-to-create-an-animated-logo-with-svg-and-css-animations-dbf0802a47a1?source=rss-51957683d04f------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbf0802a47a1</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[logo-design]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[branding]]></category>
            <dc:creator><![CDATA[Katherine Kato]]></dc:creator>
            <pubDate>Fri, 17 Aug 2018 15:15:14 GMT</pubDate>
            <atom:updated>2018-08-17T15:15:14.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*LzU_2ehRnkc3tkAhW2MZUQ.gif" /></figure><p>Thoughtful logo design requires a designer to distill the essence of a brand into shapes and colors. In an overly crowded marketplace, one of the most important features of a brand is the ability to stand out and be memorable.</p><blockquote>A successful logo is memorable and tells a compelling story about your brand without using any words</blockquote><p>Enhancing a logo through animation further sets a brand apart from the competition. An animation can elegantly expand on your brand’s story.</p><p>The <a href="https://fullstackdigital.com/">Fullstack Digital</a> logo animation represents the 3 layers of services we offer: brand, web, and market.</p><p>In this tutorial I will show you how to recreate the <a href="https://fullstackdigital.com/">Fullstack Digital</a> logo using CSS animations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*PDKI18G3f05AQqcPhQnj_A.png" /></figure><p>Let’s start with animating the furthest left SVG shape as that is what appears first in the animation. Here is the starting code for the logo:</p><pre>&lt;svg xmlns=&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; width=&quot;100%&quot; height=&quot;100%&quot; viewBox=&quot;0 0 792 519&quot;&gt;<br>  &lt;polygon class=&quot;clss-1&quot; points=&quot;265.46 519 0 385.28 151.88 0 462.25 0 265.46 519&quot;/&gt;<br>  &lt;polygon class=&quot;clss-2&quot; points=&quot;430.34 519 322.94 464.08 499.23 0 627.12 0 430.34 519&quot;/&gt;<br>  &lt;polygon class=&quot;clss-3&quot; points=&quot;595.22 519 487.76 464.08 664.1 0 792 0 595.22 519&quot;/&gt;<br>&lt;/svg&gt;</pre><p>Each polygon shape within the SVG is defined by a class, .clss-1 being the polygon on the left, .clss-2 in the center, and .clss-3 on the right.</p><h3>SVG order</h3><p>The current order of the polygon shapes within the SVG will not work as the middle and right shapes would be in front of the left shape when we need them to be behind it.</p><p>Using the z-index CSS property will not work as the <a href="https://www.w3.org/TR/2015/WD-SVG2-20150915/render.html">SVG Rendering Model</a> states. SVGs will render elements in the order as they appear, so we will need to simply rearrange the order the of the polygon shapes like so:</p><pre>...<br>  &lt;polygon class=&quot;clss-3&quot; points=&quot;595.22 519 487.76 464.08 664.1 0 792 0 595.22 519&quot;/&gt;<br>  &lt;polygon class=&quot;clss-2&quot; points=&quot;430.34 519 322.94 464.08 499.23 0 627.12 0 430.34 519&quot;/&gt;<br>  &lt;polygon class=&quot;clss-1&quot; points=&quot;265.46 519 0 385.28 151.88 0 462.25 0 265.46 519&quot;/&gt;<br>...</pre><h3>Animating the shapes</h3><p>To create the animation, we use the CSS @keyframes rule. We can then name the animation and apply the transform property. Let’s start with animating the furthest left SVG shape as that is what appears first in the animation. For instance, we will need to create an animation that causes the left SVG shape to appear from the left side.</p><p>The animation will be broken down using percentages. 0% being the start of the animation and 100% being the end. We will have the shape expand and move to the left using the transform property with translate() and scaleX() functions:</p><pre>@keyframes widthAni {<br>  0% {<br>    transform: translate(-30%, 0) scaleX(0);<br>  }<br>  20%, 75% {<br>    transform: translate(0, 0) scaleX(1);<br>  }<br>  95%, 100% {<br>    transform: translate(-30%, 0) scaleX(0);<br>  }<br>}</pre><h3>Calling the animation</h3><p>Since the left shape is defined as .clss-1, we will apply the widthAni animation to run infinitely for 4 seconds and set the transform-origin by adding this to the CSS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*B7Pj36sPPlW9rX7yfqkITA.gif" /></figure><pre>.clss-1 {<br>  animation: widthAni 4s ease-in-out infinite;<br>  transform-origin: center right;<br>}</pre><h3>Animating the rest</h3><p>Only the left shape was animated and now all that is left is to animate the other two shapes.</p><p>Like the first one, the middle and right shape will use @keyframes rule with the transform property to animate. They will also use the opacity property during some parts of the animation to hide and appear:</p><pre>@keyframes springOut {<br>  0%, 20% {<br>    transform: translate(-21%, 0%);<br>    opacity: 0;<br>  }<br>  21% {<br>    transform: translate(-20.5%, 0%);<br>    opacity: 1;<br>  }<br>  27% {<br>    transform: translate(-4.75%, 0%);<br>    opacity: 1;<br>  }<br>  31%, 55% {<br>    transform: translate(0%, 0%);<br>    opacity: 1;<br>  }<br>  67% {<br>    transform: translate(-20.5%, 0);<br>    opacity: 1;<br>  }<br>  68%, 90%, 100% {<br>    transform: translate(-21%, 0);<br>    opacity: 0;<br>  }<br>}</pre><pre>@keyframes springOutAgain {<br>  0%, 20% {<br>    transform: translate(-41.5%, 0%);<br>    opacity: 0;<br>  }<br>  21% {<br>    transform: translate(-41%, 0%);<br>    opacity: 1;<br>  }<br>  27% {<br>    transform: translate(-9.5%, 0%);<br>    opacity: 1;<br>  }<br>  31%, 55% {<br>    transform: translate(0%, 0%);<br>    opacity: 1;<br>  }<br>  67% {<br>    transform: translate(-41%, 0%);<br>    opacity: 1;<br>  }<br>  68%, 90%, 100% {<br>    transform: translate(-41.5%, 0%);<br>    opacity: 0;<br>  }<br>}</pre><p>And apply the animation to their respective shapes. The animations play infinitely for 4 seconds:</p><pre>.clss-2 {<br>  animation: springOut 4s ease-in infinite;<br>}</pre><pre>.clss-3 {<br>  animation: springOutAgain 4s ease-in infinite;<br>}</pre><p>The animation is not infinite on the <a href="https://fullstackdigital.com/">homepage of our website</a>.</p><h3>Vendor prefixes</h3><p>For simplicity, the code above does not use any vendor prefixes. You will want to include them while working with CSS animations and @keyframes. In doing so, the animation will render properly within supported browsers.</p><p>For example, the widthAni animation for .clss-1 would have vendor prefixes like this:</p><pre>@-webkit-keyframes widthAni {<br> 0% {<br>   -webkit-transform: translate(-30%, 0) scaleX(0);<br>   transform: translate(-30%, 0) scaleX(0);<br> }<br> 20%, 75% {<br>   -webkit-transform: translate(0, 0) scaleX(1);<br>   transform: translate(0, 0) scaleX(1);<br> }<br> 95%, 100% {<br>   -webkit-transform: translate(-30%, 0) scaleX(0);<br>   transform: translate(-30%, 0) scaleX(0);<br> }<br>}</pre><pre>@keyframes widthAni {<br> 0% {<br>   -webkit-transform: translate(-30%, 0) scaleX(0);<br>   transform: translate(-30%, 0) scaleX(0);<br> }<br> 20%, 75% {<br>   -webkit-transform: translate(0, 0) scaleX(1);<br>   transform: translate(0, 0) scaleX(1);<br> }<br> 95%, 100% {<br>   -webkit-transform: translate(-30%, 0) scaleX(0);<br>   transform: translate(-30%, 0) scaleX(0);<br> }<br>}</pre><h3>Conclusion</h3><p>View it live on the <a href="https://fullstackdigital.com/">Fullstack Digital</a> homepage, or check out this codepen:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffullstackdigital%2Fembed%2Fpreview%2FRyVWJW%3Fheight%3D600%26slug-hash%3DRyVWJW%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffullstackdigital%2Fpen%2FRyVWJW&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1954961.RyVWJW.small.d643fa73-8eaa-43ce-87ad-c91a519f3b4d.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/83a7bb92f940c9ed9aaf32cefbbd9083/href">https://medium.com/media/83a7bb92f940c9ed9aaf32cefbbd9083/href</a></iframe><p>If you’d like to easily build blazing fast websites with flawless layouts, we’re releasing a <strong>free visual website builder </strong>soon. It’s a great alternative to Wordpress.<strong> Sign up for early access below:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fefcb11%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fefcb11%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/14568360bba2410aac2e339538e5a069/href">https://medium.com/media/14568360bba2410aac2e339538e5a069/href</a></iframe><p><em>When I’m not writing, I’m helping businesses go further, faster at </em><a href="https://fullstackdigital.com/"><em>Fullstack Digital</em></a><em>. We provide digital brand strategy, design, development, and marketing for forward-thinking companies. Check out some of our work </em><a href="https://fullstackdigital.com/work/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbf0802a47a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstack-digital/how-to-create-an-animated-logo-with-svg-and-css-animations-dbf0802a47a1">How to create an animated logo with SVG and CSS animations</a> was originally published in <a href="https://medium.com/fullstack-digital">Fullstack Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an animated dashed line background with SVG and CSS]]></title>
            <link>https://medium.com/fullstack-digital/creating-an-animated-dashed-line-background-with-svg-and-css-170f89f47000?source=rss-51957683d04f------2</link>
            <guid isPermaLink="false">https://medium.com/p/170f89f47000</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[landing-pages]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[svg]]></category>
            <dc:creator><![CDATA[Katherine Kato]]></dc:creator>
            <pubDate>Tue, 31 Jul 2018 15:05:08 GMT</pubDate>
            <atom:updated>2019-03-05T14:34:01.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZcKbwb0eczb0u792UrCWwg.gif" /></figure><p>In this tutorial I will show you how to create a neat SVG background animation using CSS animation. This pattern was built for the <a href="https://twitter.com/pancakesbuilder">Pancakes Builder</a> landing page. Pancakes is an upcoming free website builder for <a href="https://gohugo.io/">Hugo</a>, a powerful static site generator.</p><figure><a href="https://bossfreelance.com/"><img alt="" src="https://cdn-images-1.medium.com/max/397/1*Sm9xbsYc9rc-33cQbi6Tfw.jpeg" /></a></figure><h3>Creating the SVG</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*SeXJtK-ALkdHbXB1_xPFVw.png" /></figure><p>Start off by making a straight line with the &lt;line&gt; tag wrapped in the &lt;svg&gt; tag like this:</p><pre>&lt;svg width=&quot;100%&quot; height=&quot;100%&quot; xmlns=&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; preserveAspectRatio=&quot;xMidYMid&quot;&gt;<br>  &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>&lt;/svg&gt;</pre><p>The width and height should be to 100% since the SVG will need to be stretched to fit the screen width and height. On &lt;line&gt;, the x1 and x2 values are defined as the horizontal starting and ending points of a line, while y1 and y2 are the vertical starting and ending points. The current values will create a simple, straight line that fills the screen width at 100%.</p><p>To create the dashes, we will use the stroke-dasharray property. The first value is the stroke size and the second is the space in between each dash. Let’s use CSS to define the values 66 and 16 to start like so:</p><pre>line {<br>  stroke: #f4f4f4;<br>  stroke-dasharray: 66, 16;<br>}</pre><p>Now you should have one simple dashed line. To increase the line stroke weight and give it rounded edges, you can define them with CSS:</p><pre>line {<br>  ...<br>  stroke-width: 10;<br>  stroke-linecap: round;<br>  ...<br>}</pre><p>Time to create the pattern. Adjust the code in the &lt;svg&gt;:</p><pre>&lt;svg width=&quot;100%&quot; height=&quot;100%&quot; xmlns=&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; preserveAspectRatio=&quot;xMidYMid&quot;&gt;<br>  &lt;defs&gt;<br>    &lt;pattern id=&quot;pancakes-pattern&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;200&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>    &lt;/pattern&gt;<br>  &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot; fill=&quot;url(#pancakes-pattern)&quot;&gt;&lt;/rect&gt;<br>&lt;/svg&gt;</pre><p>With CSS, set the height of &lt;svg&gt; to 100vh. The pattern will then cover 100% of the current viewport height. However, you will notice that there are some blank space in the pattern.</p><p>At this point it is just all about calculating how much space for each &lt;line&gt; on each row by changing the y1 and y2 values. Starting from the first &lt;line&gt; having y1 and y2 values of 15, add 25 each time for each row. In this instance, the next few &lt;line&gt; tags would look like the following:</p><pre>...<br>      &lt;line x1=&quot;0&quot; y1=&quot;40&quot; x2=&quot;100%&quot; y2=&quot;40&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;65&quot; x2=&quot;100%&quot; y2=&quot;65&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;90&quot; x2=&quot;100%&quot; y2=&quot;90&quot; /&gt;<br>...</pre><p>Keep adding the values until the pattern does not have anymore blank space.</p><h3>Nesting the &lt;pattern&gt;</h3><p>To add the colored area to the pattern, the &lt;svg&gt; code is edited to be:</p><pre>&lt;svg width=&quot;100%&quot; height=&quot;100%&quot; xmlns=&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; preserveAspectRatio=&quot;xMidYMid&quot;&gt;<br>  &lt;defs&gt;<br>    &lt;pattern id=&quot;pancakes-pattern&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;200&quot;  patternUnits=&quot;userSpaceOnUse&quot;&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>      ...<br>      &lt;line x1=&quot;0&quot; y1=&quot;215&quot; x2=&quot;100%&quot; y2=&quot;215&quot; /&gt;<br>    &lt;/pattern&gt;<br>    &lt;pattern id=&quot;logo&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;200&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>      ...<br>      &lt;line x1=&quot;0&quot; y1=&quot;215&quot; x2=&quot;100%&quot; y2=&quot;215&quot; /&gt;<br>    &lt;/pattern&gt;<br>  &lt;/defs&gt;<br>  &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot; fill=&quot;url(#pancakes-pattern)&quot;&gt;&lt;/rect&gt;<br>  &lt;rect x=&quot;22%&quot; y=&quot;27%&quot; width=&quot;250&quot; height=&quot;150&quot; fill=&quot;url(#logo)&quot;/&gt;<br>&lt;/svg&gt;</pre><p>And add this to the CSS:</p><pre>#logo line {<br>  stroke: #ffd05e;<br>}</pre><h3>Animating the &lt;pattern&gt;</h3><p>Using CSS animations, we can use the stroke-dashoffset property to animate the lines. First, set the &lt;line&gt; to have a value for stroke-dashoffset:</p><pre>line {<br>  ...<br>  stroke-dashoffset: 82;<br>}</pre><p>Then create a @keyframes rule and set the stroke-dashoffset to 0:</p><pre><a href="http://twitter.com/keyframes">@keyframes</a> lineMove {<br>  to {<br>    stroke-dashoffset: 0;<br>  }<br>}</pre><p>Finally, use the CSS :nth-child selector for the &lt;line&gt; tag. Define them with odd and even values and have the even value play the animation in reverse like this:</p><pre>line:nth-child(odd) {<br>  animation: lineMove 2s infinite linear;<br>}</pre><pre>line:nth-child(even) {<br>  animation: lineMove 2s infinite linear reverse;<br>}</pre><h3>Wrapping Up</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffullstackdigital%2Fembed%2Fpreview%2FKBZbKr%3Fheight%3D600%26slug-hash%3DKBZbKr%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffullstackdigital%2Fpen%2FKBZbKr&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/24a7ea8b734052d3fd6fb23f2bd33718/href">https://medium.com/media/24a7ea8b734052d3fd6fb23f2bd33718/href</a></iframe><p>Here is how the SVG code should look when completed:</p><pre>&lt;svg width=&quot;100%&quot; height=&quot;100%&quot; xmlns=&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; preserveAspectRatio=&quot;xMidYMid&quot;&gt;<br>  &lt;defs&gt;<br>    &lt;pattern id=&quot;pancakes-pattern&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;200&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;40&quot; x2=&quot;100%&quot; y2=&quot;40&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;65&quot; x2=&quot;100%&quot; y2=&quot;65&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;90&quot; x2=&quot;100%&quot; y2=&quot;90&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;115&quot; x2=&quot;100%&quot; y2=&quot;115&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;140&quot; x2=&quot;100%&quot; y2=&quot;140&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;165&quot; x2=&quot;100%&quot; y2=&quot;165&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;190&quot; x2=&quot;100%&quot; y2=&quot;190&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;215&quot; x2=&quot;100%&quot; y2=&quot;215&quot; /&gt;<br>    &lt;/pattern&gt;<br>    &lt;pattern id=&quot;logo&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;200&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;15&quot; x2=&quot;100%&quot; y2=&quot;15&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;40&quot; x2=&quot;100%&quot; y2=&quot;40&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;65&quot; x2=&quot;100%&quot; y2=&quot;65&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;90&quot; x2=&quot;100%&quot; y2=&quot;90&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;115&quot; x2=&quot;100%&quot; y2=&quot;115&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;140&quot; x2=&quot;100%&quot; y2=&quot;140&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;165&quot; x2=&quot;100%&quot; y2=&quot;165&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;190&quot; x2=&quot;100%&quot; y2=&quot;190&quot; /&gt;<br>      &lt;line x1=&quot;0&quot; y1=&quot;215&quot; x2=&quot;100%&quot; y2=&quot;215&quot; /&gt;<br>    &lt;/pattern&gt;<br>  &lt;/defs&gt;<br>  &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot; fill=&quot;url(#pancakes-pattern)&quot;&gt;&lt;/rect&gt;<br>  &lt;rect x=&quot;22%&quot; y=&quot;27%&quot; width=&quot;250&quot; height=&quot;150&quot; fill=&quot;url(#logo)&quot;/&gt;<br>&lt;/svg&gt;</pre><p>And the CSS:</p><pre>svg {<br>  height: 100vh;<br>}</pre><pre>line {<br>  stroke: #f4f4f4;<br>  stroke-width: 10;<br>  stroke-linecap: round;<br>  stroke-dasharray: 66, 16;<br>  stroke-dashoffset: 82;<br>}</pre><pre>line:nth-child(odd) {<br>  animation: lineMove 2s infinite linear;<br>}</pre><pre>line:nth-child(even) {<br>  animation: lineMove 2s infinite linear reverse;<br>}</pre><pre>#logo line {<br>  stroke: #ffd05e;<br>}</pre><pre><a href="http://twitter.com/keyframes">@keyframes</a> lineMove {<br>  to {<br>    stroke-dashoffset: 0;<br>  }<br>}</pre><p>That’s it! This is my first article here on Medium and I wanted to share my process on how I made this SVG line animation background. Referencing the <a href="https://developer.mozilla.org/en-US/docs/Web/SVG">MDN Web Docs</a> and <a href="http://shop.oreilly.com/product/0636920037972.do">Using SVG with CSS3 and HTML5 (O’Reilly)</a> helped me with understanding and creating this animation.</p><figure><a href="https://bossfreelance.com/"><img alt="" src="https://cdn-images-1.medium.com/max/397/1*Sm9xbsYc9rc-33cQbi6Tfw.jpeg" /></a></figure><p><em>When I’m not writing, I’m helping businesses go further, faster at </em><a href="https://fullstackdigital.com/"><em>Fullstack Digital</em></a><em>. We provide digital brand strategy, design, development, and marketing for forward-thinking companies. Check out some of our work </em><a href="https://fullstackdigital.com/work/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=170f89f47000" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstack-digital/creating-an-animated-dashed-line-background-with-svg-and-css-170f89f47000">Creating an animated dashed line background with SVG and CSS</a> was originally published in <a href="https://medium.com/fullstack-digital">Fullstack Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>