<?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>Forem: SteinarV-design</title>
    <description>The latest articles on Forem by SteinarV-design (@steinarvdesign).</description>
    <link>https://forem.com/steinarvdesign</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%2F713498%2F07a20c28-584c-41c3-ac28-6acaef7a1ef0.jpeg</url>
      <title>Forem: SteinarV-design</title>
      <link>https://forem.com/steinarvdesign</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/steinarvdesign"/>
    <language>en</language>
    <item>
      <title>Random positioning of particle emitter on screen with vanilla Javascript and GSAP.</title>
      <dc:creator>SteinarV-design</dc:creator>
      <pubDate>Sun, 01 Jan 2023 03:24:15 +0000</pubDate>
      <link>https://forem.com/steinarvdesign/random-positioning-of-particle-emitter-on-screen-with-vanilla-javascript-and-gsap-24f9</link>
      <guid>https://forem.com/steinarvdesign/random-positioning-of-particle-emitter-on-screen-with-vanilla-javascript-and-gsap-24f9</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/steinarV/embed/qByZGWw?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  About GSAP
&lt;/h2&gt;

&lt;p&gt;GSAP (GreenSock Animation Platform) is a robust&lt;br&gt;
high-performance JavaScript animation library.&lt;br&gt;
Read more at: &lt;a href="https://greensock.com/docs/" rel="noopener noreferrer"&gt;https://greensock.com/docs/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The html-file
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffxvifu03g4pmo9eavu7a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffxvifu03g4pmo9eavu7a.png" alt="Html" width="800" height="1295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Javascript-files
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F02vlk4e5a5pdsvh585z1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F02vlk4e5a5pdsvh585z1.png" alt="Javascript-1" width="800" height="1314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8n0ueab2horx2043n9h9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8n0ueab2horx2043n9h9.png" alt="Javascript-2" width="500" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F558qgd8jmld9rjn9hamj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F558qgd8jmld9rjn9hamj.png" alt="SVG area" width="600" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SVG code detail
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fymzipr86j8lhnn4y1qrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fymzipr86j8lhnn4y1qrq.png" alt="SVG code" width="500" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About Codepen
&lt;/h2&gt;

&lt;p&gt;"Codepen" - &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;https://codepen.io/&lt;/a&gt; - is a social development environment - an online code editor for developers of any skill - that allows people to write code in the browser, and see the results of it as they build. Codepen is particularly useful for people learning to code.&lt;/p&gt;

&lt;p&gt;View the full code for this pen at &lt;a href="https://codepen.io/steinarV/pen/qByZGWw" rel="noopener noreferrer"&gt;https://codepen.io/steinarV/pen/qByZGWw&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a link to my blog: &lt;a href="https://steinarv.design/blog" rel="noopener noreferrer"&gt;https://steinarv.design/blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for watching !&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Import and animate an external SVG file with Javascript and Gsap.</title>
      <dc:creator>SteinarV-design</dc:creator>
      <pubDate>Tue, 20 Dec 2022 01:30:49 +0000</pubDate>
      <link>https://forem.com/steinarvdesign/import-and-animate-an-external-svg-file-with-javascript-and-gsap-4ikb</link>
      <guid>https://forem.com/steinarvdesign/import-and-animate-an-external-svg-file-with-javascript-and-gsap-4ikb</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/steinarV/embed/KKBKpPd?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  About GSAP
&lt;/h2&gt;

&lt;p&gt;GSAP (GreenSock Animation Platform) is a robust &lt;br&gt;
high-performance JavaScript animation library. &lt;br&gt;
Read more at: &lt;a href="https://greensock.com/docs/" rel="noopener noreferrer"&gt;https://greensock.com/docs/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The html-file
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffba7vt8zytgo06rpehqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffba7vt8zytgo06rpehqo.png" alt="html" width="600" height="969"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Javascript-file
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjftpavkelsxongig9mn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjftpavkelsxongig9mn9.png" alt="js" width="600" height="1140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fusxm28u4jzjc7zn2pn1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fusxm28u4jzjc7zn2pn1i.png" alt="Visualisation" width="600" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code from the external SVG-file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" id="mysvg" viewBox="0 0 1460 930"&amp;gt;
&amp;lt;style type="text/css"&amp;gt;
    .st1{fill:#FFFFFF;}
    .st2{fill:#FC5B6B;}
&amp;lt;/style&amp;gt;

&amp;lt;g id="m1" class="item m1"&amp;gt;
    &amp;lt;path id="m1black" d="M348.7,666.5c-60.1,72.5-62.9,104-62.9,104c-2.1,15.3,8.6,20.8,8.6,20.8l2.6,0.8c1.6,0.3,1.6,1.6,1.6,1.6   c0.3,0.8-1.6,1.3-1.6,1.3c-27.3,0.5-28.6-27.3-28.6-27.3c-1-7.3,3.4-21.3,3.4-21.3c1.6-4.7,3.6-10.1,6.8-16.4   c10.4-21.3,39.8-60.6,39.8-60.6l-0.5-0.3c-54.6,62.4-71,85-71,85c-14.8,22.4-20.3,35.6-20.3,35.6c-1.6,2.6,0.3,4.9,0.3,4.9   c0.8,1,0,2.1,0,2.1c-0.5,1.3-3.4,0.3-3.4,0.3c-13.5-7.3-13.5-19.8-13.5-19.8c-1-4.7,6.8-19.8,6.8-19.8c30.4-57.2,58-95.2,58-95.2   l-0.5-0.5c-76.7,81.1-90.5,100.6-90.5,100.6c-17.4,24.4-16.6,33.3-16.6,33.3c0,1.8,1.3,4.7,1.3,4.7c0.8,1.6-1,2.9-1,2.9   c-1.6,1.3-3.9-0.8-3.9-0.8c-12.7-12.2-12.7-20.3-12.7-20.3c-3.6-5.5,13.5-30.9,13.5-30.9c49.7-69.9,54.9-78.5,54.9-78.5   c14.3-20.5,14.8-26.3,14.8-26.3c0.8-1.6-0.8-1-0.8-1c-33.3,12.5-63.7,36.9-63.7,36.9c-34.1,26.3-44.2,40-44.2,40   c-0.3,1,4.7,1.3,4.7,1.3c2.1-0.3,2.1,1.6,2.1,1.6c0.5,0.8-1.3,1.6-1.3,1.6c-10.1,4.7-16.4-1.3-16.4-1.3   c-8.8-7.5-11.7-15.6-11.7-15.6c-1.3-1.3,2.6-4.4,2.6-4.4c16.9-13.5,37.7-28.1,37.7-28.1c15.3-11.4,33.3-21.8,47.6-28.9   c23.7-11.4,34.6-13,34.6-13c7-1,12.5,3.9,12.5,3.9l4.9,4.7c5.5,5.2,3.4,14.8,3.4,14.8c-3.1,18.7-23.4,45.8-23.4,45.8   c-12.5,16.9-15.6,20-15.6,20l0.5,0.8l54.1-61.9l17.7-20.3c2.6-3.6,5.7-3.6,5.7-3.6c1.8-0.5,5.5,2.6,5.5,2.6 c8.6,7.5,11.4,10.4,11.4,10.4c3.9,3.6,0.3,9.1,0.3,9.1l-46.5,70.5l0.5,0.5c52.8-65.5,70.2-83.2,70.2-83.2c3.4-6.2,7.5-4.2,7.5-4.2   c8.3,5.2,15.3,12.5,15.3,12.5C354.1,661.1,348.7,666.5,348.7,666.5z"/&amp;gt;
    &amp;lt;path id="m1white" class="st1" d="M347.7,656.5c-60.1,72.5-62.9,104-62.9,104c-2.1,15.3,8.6,20.8,8.6,20.8l2.6,0.8   c1.6,0.3,1.6,1.6,1.6,1.6c0.3,0.8-1.6,1.3-1.6,1.3c-27.3,0.5-28.6-27.3-28.6-27.3c-1-7.3,3.4-21.3,3.4-21.3   c1.6-4.7,3.6-10.1,6.8-16.4c10.4-21.3,39.8-60.6,39.8-60.6l-0.5-0.3c-54.6,62.4-71,85-71,85c-14.8,22.4-20.3,35.6-20.3,35.6   c-1.6,2.6,0.3,4.9,0.3,4.9c0.8,1,0,2.1,0,2.1c-0.5,1.3-3.4,0.3-3.4,0.3c-13.5-7.3-13.5-19.8-13.5-19.8c-1-4.7,6.8-19.8,6.8-19.8   c30.4-57.2,58-95.2,58-95.2l-0.5-0.5c-76.7,81.1-90.5,100.6-90.5,100.6c-17.4,24.4-16.6,33.3-16.6,33.3c0,1.8,1.3,4.7,1.3,4.7   c0.8,1.6-1,2.9-1,2.9c-1.6,1.3-3.9-0.8-3.9-0.8c-12.7-12.2-12.7-20.3-12.7-20.3c-3.6-5.5,13.5-30.9,13.5-30.9   c49.7-69.9,54.9-78.5,54.9-78.5c14.3-20.5,14.8-26.3,14.8-26.3c0.8-1.6-0.8-1-0.8-1c-33.3,12.5-63.7,36.9-63.7,36.9   c-34.1,26.3-44.2,40-44.2,40c-0.3,1,4.7,1.3,4.7,1.3c2.1-0.3,2.1,1.6,2.1,1.6c0.5,0.8-1.3,1.6-1.3,1.6c-10.1,4.7-16.4-1.3-16.4-1.3   c-8.8-7.5-11.7-15.6-11.7-15.6c-1.3-1.3,2.6-4.4,2.6-4.4c16.9-13.5,37.7-28.1,37.7-28.1c15.3-11.4,33.3-21.8,47.6-28.9   c23.7-11.4,34.6-13,34.6-13c7-1,12.5,3.9,12.5,3.9l4.9,4.7c5.5,5.2,3.4,14.8,3.4,14.8c-3.1,18.7-23.4,45.8-23.4,45.8   c-12.5,16.9-15.6,20-15.6,20l0.5,0.8l54.1-61.9l17.7-20.3c2.6-3.6,5.7-3.6,5.7-3.6c1.8-0.5,5.5,2.6,5.5,2.6   c8.6,7.5,11.4,10.4,11.4,10.4c3.9,3.6,0.3,9.1,0.3,9.1l-46.5,70.5l0.5,0.5c52.8-65.5,70.2-83.2,70.2-83.2c3.4-6.2,7.5-4.2,7.5-4.2   c8.3,5.2,15.3,12.5,15.3,12.5C353.1,651.1,347.7,656.5,347.7,656.5z"/&amp;gt;
&amp;lt;/g&amp;gt;
&amp;lt;g id="e" class="item e"&amp;gt;
            &amp;lt;path id="eblack" d="M348.7,666.5c-60.1 . . . . . 6.5z"/&amp;gt;
            &amp;lt;path id="ewhite" class="st1" d="M347.7,6 . . . . . 7,656.5z"/&amp;gt;
&amp;lt;/g&amp;gt;
/* more &amp;lt;g&amp;gt; &amp;lt;/g&amp;gt; elements here*/
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  About Codepen
&lt;/h2&gt;

&lt;p&gt;"Codepen" - &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;https://codepen.io/&lt;/a&gt; - is a social development environment - an online code editor for developers of any skill - that allows people to write code in the browser, and see the results of it as they build. Codepen is particularly useful for people learning to code.&lt;/p&gt;

&lt;p&gt;View the full code for this pen at &lt;a href="https://codepen.io/steinarV/pen/KKBKpPd" rel="noopener noreferrer"&gt;https://codepen.io/steinarV/pen/KKBKpPd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a link to my blog: &lt;a href="https://steinarv.design/blog" rel="noopener noreferrer"&gt;https://steinarv.design/blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for watching !&lt;/p&gt;

</description>
      <category>aws</category>
      <category>help</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Finite State Machine w. vanilla JavaScript example</title>
      <dc:creator>SteinarV-design</dc:creator>
      <pubDate>Sun, 11 Dec 2022 04:36:48 +0000</pubDate>
      <link>https://forem.com/steinarvdesign/finite-state-machine-w-vanilla-javascript-example-381e</link>
      <guid>https://forem.com/steinarvdesign/finite-state-machine-w-vanilla-javascript-example-381e</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/steinarV/embed/eYBowaw?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Definition
&lt;/h2&gt;

&lt;p&gt;The finite state machine can only have one single state active at the same time. This means that the machine has to transition from one state to another, in order to perform different actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code excerpts
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fi1sckx4u04gi68z8msy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fi1sckx4u04gi68z8msy3.png" alt="Html file" width="600" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fyw0szjoszixhmrjc6mqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyw0szjoszixhmrjc6mqv.png" alt="Script file" width="600" height="811"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fegvxu74b5az0qz4hbru8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fegvxu74b5az0qz4hbru8.png" alt="Panels" width="600" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The state machine
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const stateMachine = {
  state: 'localTime',
  transitions: {
localTime: {
      start() {
        this.state = 'stopWatch';
      },
      stop() {
        this.state = 'localTime';
      },
      setTab() {
        this.state = 'settings';
      },
      quotesTab() {
        this.state = 'quotes';
      },
      displayTab() {
        this.state = 'localTime';
      },
    },
    stopWatch: {
      start() {
        this.state = 'stopWatch';
      },
      stop() {
        this.state = 'localTime';
      },
      setTab() {
        this.state = 'stopWatch';
      },
      finish() {
        this.state = 'localTime';
      },
      quotesTab() {
        this.state = 'stopWatch';
      },
      displayTab() {
        this.state = 'stopWatch';
      },
    },
    settings: {
      start() {
        this.state = 'settings';
      },
      stop() {
        this.state = 'settings';
      },
      setTab() {
        this.state = 'settings';
      },
      quotesTab() {
        this.state = 'settings';
      },
      displayTab() {
        this.state = 'localTime';
      },
    },
    quotes: {
      start() {
        this.state = 'quotes';
      },
      stop() {
        this.state = 'quotes';
      },
      setTab() {
        this.state = 'quotes';
      },
      quotesTab() {
        this.state = 'quotes';
      },
      displayTab() {
        this.state = 'localTime';
      },
    },
  },
  dispatch(actionName) {
    const action = this.transitions[this.state][actionName];

    if (action) {
      action.call(this);
    } else {
      console.log('invalid action');
    }
  },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Diagram of the machine
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fuj2pbfcxohlbcn2pp0ui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fuj2pbfcxohlbcn2pp0ui.png" alt="Visualisation" width="600" height="731"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to transition between states
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let code = ``

code = `
          &amp;lt;button class="stop" onClick="stopClicked()"&amp;gt;Stop&amp;lt;/button&amp;gt;

          &amp;lt;button class="quotes" onClick="quotesOnTop()"&amp;gt;Quotes&amp;lt;/button&amp;gt;

          &amp;lt;button class="settings" onClick="settingsOnTop()"&amp;gt;Settings&amp;lt;/button&amp;gt;

          &amp;lt;button class="display" onClick="displayOnTop()"&amp;gt;Display&amp;lt;/button&amp;gt;

          &amp;lt;button class="start" onClick="startClicked()"&amp;gt;Start&amp;lt;/button&amp;gt;
`;

function startClicked() {
  if (stateMachine.state === 'localTime') {
    stateMachine.dispatch('start');
  }
}

function stopClicked() {
  if (stateMachine.state === 'stopWatch') {
    stateMachine.dispatch('stop');
  }
}

const displayOnTop = () =&amp;gt; {
  if (
    stateMachine.state === 'settings' ||
    stateMachine.state === 'quotes'
  ) {
    stateMachine.dispatch('displayTab');
  }
};

const settingsOnTop = () =&amp;gt; {
  if (stateMachine.state === 'localTime') {
    stateMachine.dispatch('setTab');
  }
};

const quotesOnTop = () =&amp;gt; {
  if (stateMachine.state === 'localTime') {
    stateMachine.dispatch('quotesTab');
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function createPanels( ) creates 5 buttons - Stop, Quote, Settings, Display and Start. Clicking one of these buttons will change the state of the machine. You can only click on buttons that are active. Active buttons are dependent of the state of the machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codepen
&lt;/h2&gt;

&lt;p&gt;"Codepen" - &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;https://codepen.io/&lt;/a&gt; - is a social development environment, an online code editor for developers of any skill, that allows people to write code in the browser, and see the results of it as they build. Codepen is particularly useful for people learning to code.&lt;/p&gt;

&lt;p&gt;View the full code for the state machine at &lt;br&gt;
&lt;a href="https://codepen.io/steinarV/pen/eYBowaw?editors=0010" rel="noopener noreferrer"&gt;https://codepen.io/steinarV/pen/eYBowaw?editors=0010&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a link to my blog : &lt;a href="https://steinarv.design/blog" rel="noopener noreferrer"&gt;https://steinarv.design/blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for watching !&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Responsive SVG animation w. vanilla Javascript</title>
      <dc:creator>SteinarV-design</dc:creator>
      <pubDate>Sun, 20 Nov 2022 20:51:32 +0000</pubDate>
      <link>https://forem.com/steinarvdesign/responsive-svg-animation-w-vanilla-javascript-49hj</link>
      <guid>https://forem.com/steinarvdesign/responsive-svg-animation-w-vanilla-javascript-49hj</guid>
      <description>&lt;p&gt;&lt;strong&gt;"Codepen" - &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;https://codepen.io/&lt;/a&gt; - is a social development environment - an online code editor for developers of any skill - that allows people to write code in the browser, and see the results of it as they build. Codepen is particularly useful for people learning to code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code layout for my animation&lt;/strong&gt; &lt;a href="https://codepen.io/steinarV/pen/qBKPGmK" rel="noopener noreferrer"&gt;https://codepen.io/steinarV/pen/qBKPGmK&lt;/a&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqtu6k1rfddnd7oark2ll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqtu6k1rfddnd7oark2ll.png" width="595" height="740"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh99vdqtkhkcndmytduua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh99vdqtkhkcndmytduua.png" width="595" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2thbhl3e7qvsg8vwxl7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2thbhl3e7qvsg8vwxl7u.png" width="595" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit my blog&lt;/strong&gt; &lt;a href="https://steinarv.design/blog" rel="noopener noreferrer"&gt;https://steinarv.design/blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Responsive SVG animation w. vanilla Javascript</title>
      <dc:creator>SteinarV-design</dc:creator>
      <pubDate>Fri, 18 Nov 2022 18:22:28 +0000</pubDate>
      <link>https://forem.com/steinarvdesign/responsive-svg-animation-w-vanilla-javascript-4g2g</link>
      <guid>https://forem.com/steinarvdesign/responsive-svg-animation-w-vanilla-javascript-4g2g</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/steinarV/embed/qBKPGmK?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
  </channel>
</rss>
