<?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 Lisi Linhart on Medium]]></title>
        <description><![CDATA[Stories by Lisi Linhart on Medium]]></description>
        <link>https://medium.com/@lisilinhart?source=rss-d044ac6b4b3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kxvwrjuMsfPyoNGeAuUtMw.jpeg</url>
            <title>Stories by Lisi Linhart on Medium</title>
            <link>https://medium.com/@lisilinhart?source=rss-d044ac6b4b3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:35:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lisilinhart/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[Handling touch with VueJs]]></title>
            <link>https://medium.com/@lisilinhart/handling-touch-with-vuejs-4b2a0b514861?source=rss-d044ac6b4b3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b2a0b514861</guid>
            <category><![CDATA[hammerjs]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[touch]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Lisi Linhart]]></dc:creator>
            <pubDate>Mon, 20 Aug 2018 09:13:20 GMT</pubDate>
            <atom:updated>2018-08-22T10:10:21.308Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This posts was cross posted to </em><a href="https://lisilinhart.info/posts/touch-interaction-vue"><em>my website.</em></a></p><p>When developing new applications many developers start with a desktop interface in mind. Having hover states for the mouse, having transitions between the different routes, showing delightful animations to keep the user engaged. But often we forget that most people will access an application on their phone and interaction patterns that work well on desktop, might not be optimal on mobile. Although nowadays most applications are responsive, many aren’t reactive to user interactions like touch gestures. This article will explain how we can take care of touch gestures in a Vue application. I made a <a href="https://codepen.io/lisilinhart/pen/wxRQBo">simple touch application on Codepen</a>, so I can explain some of the code snippets in this article.</p><h3>What gestures should I think about?</h3><p><a href="https://twitter.com/lukew">Luke Wroblewski</a> developed a set of <a href="https://static.lukew.com/TouchGestureCards.pdf">Touch Gesture Cards</a>to get an overview what touch gestures are available and for which functionality to use them. In this example we focus on the core touch gestures that can be carried out with one thumb, since that’s <a href="https://www.uxmatters.com/mt/archives/2013/02/how-do-users-really-hold-mobile-devices.php">how most people hold their phone</a>. Common touch gestures for when you’re only using one thumb are: tap, drag, swipe, press, doubletap.</p><h3>Touch Libraries</h3><p>For this example <a href="https://hammerjs.github.io/">HammerJs</a> was used, since it’s a very established library that isn’t too big. But there are many other Touch Libraries like: <a href="https://zingchart.github.io/zingtouch/">ZingTouch</a>, <a href="https://shopify.github.io/draggable/">Draggable</a>, <a href="https://layerjs.org/">LayerJs</a>, <a href="https://github.com/stuyam/pressure">PressureJs</a> and others. What library you use depends on what touch interaction you want incorporate in your application. For some simple tap interactions you could also write some native code to support it.</p><h3>Using HammerJs with Vue Custom Directive</h3><p>A very powerful and simple way to add touch support in Vue with HammerJS are Custom Directives. There is an excellent detailed article by Sarah Drasner on <a href="https://css-tricks.com/power-custom-directives-vue/">how to use custom directives</a>. So let’s say you want to add support for dragging / panning in your application, you could add the following directive to your Vue application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8e9ed9215619598f901519de80eea99/href">https://medium.com/media/d8e9ed9215619598f901519de80eea99/href</a></iframe><p>And then to use the custom directive, you would add v-pan=“onPan” on your element:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ae1af43c13b5364b10ad79e6ee8eaa7/href">https://medium.com/media/2ae1af43c13b5364b10ad79e6ee8eaa7/href</a></iframe><p>This would bind a HammerJs Pan Recognizer to this element and whenever a pan gesture happens on our element, the onPan function will be called.</p><h3>Handling the touch event</h3><p>Whenever a pan touch event happens on our element, our onPan function will be called with the the HammerJs event object as a parameter. This event object has a lot of different properties with information for the current touch event. You can log the event to see what properties are available. Depending on what you’re trying to do you’re going to need different properties. For the <a href="https://codepen.io/lisilinhart/pen/wxRQBo">slider example</a> in this article, we only wanted to animate the slider on the horizontal axis, so all we needed were event.deltaX and event.isFinal.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c7705b691c5402302f853180fdaae6e/href">https://medium.com/media/6c7705b691c5402302f853180fdaae6e/href</a></iframe><h3>Animating elements according to touch input</h3><p>If an element should be moved according to the speed and distance of the drag gesture, that has to be done in Javascript, because this user input is dynamic and we can’t predefine static animations in CSS, since the output will always be slightly different. What can be done however is just updating a CSS Variable in Javascript instead of updating the specific property. To animate our slider in a performant way we’re animating the CSS transform property by updating the —x CSS Variable. Animating transform is more performant, since it will only trigger changes in the composite layer instead of they layout layer. If we animate left or width, we would trigger changes in the layout layer, which in return would cause style recalculations and is less performant.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30635f64acb67264e4b19fa04a4cfa1e/href">https://medium.com/media/30635f64acb67264e4b19fa04a4cfa1e/href</a></iframe><p>Be aware that if you’re continuously updating the transform property in Javascript, you shouldn’t have a transition defined for this property like for example transition: transform 0.3s ease;. If you had a transition defined, your browser will try transitioning between these fast transform changes, which will result in bad performance. Now for our example we’re calculating how far the slider has been dragged in a percentage from 0 to 100% and then adding this percentage to where the slider had been before. Then we’re updating our CSS Variable accordingly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f9c6c4726f74b08796d9799e78cb211/href">https://medium.com/media/3f9c6c4726f74b08796d9799e78cb211/href</a></iframe><h3>Animating when touch ends</h3><p>By now our slider gets updated whenever we drag it, but what if we drag it off the screen? We don’t want the slider to stay dragged of the screen, which is why we want to animate it back whenever the user stopped dragging it. This can be done with the event.isFinal parameter of our touch event. In the following code sample, when the event is the final event, we check how far the user dragged the slide. If the slider was dragged further than it should go, it will go back to the last item. If it was dragged to the right further than the first item, it will go back to transform: translateX(0%); and if the user hasn’t dragged it out of the window, it will go to the next item to the left or right depending on the drag direction. Then once we calculated where the slider should go when the touch event has ended, we animate it back with GSAP or whatever other animation tool you prefer, adding a little delightful bounce by defining ease: Elastic.easeOut.config(1, 0.8) on the animation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8708cc8040647007d20a252eff54196/href">https://medium.com/media/b8708cc8040647007d20a252eff54196/href</a></iframe><h3>Conclusion</h3><p>Animation and touch gestures like sliding or dragging are tightly linked and adding some reactions to touch gestures will make it more engaging and fun to use. However there is also a downsides to adding touch interactions. This dynamic reaction to touch input can only be done in Javascript. So whenever a touch event is happening, Javascript has to be parsed and how fast the Javascript can be parsed heavily depends on the computing power of the mobile device. If your Javascript calculations are very complex and the device isn’t very strong, it can result in bad performance. That’s why it’s important to always test your interactions on different, average devices and to check if the performance is still acceptable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b2a0b514861" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with GatsbyJS]]></title>
            <link>https://medium.com/@lisilinhart/getting-started-with-gatsbyjs-8f1434cbf28e?source=rss-d044ac6b4b3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f1434cbf28e</guid>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Lisi Linhart]]></dc:creator>
            <pubDate>Wed, 09 May 2018 15:00:40 GMT</pubDate>
            <atom:updated>2018-05-09T15:06:26.327Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This posts was cross posted to </em><a href="https://lisilinhart.info/posts/getting-started-gatsby"><em>my website</em></a><em>.</em></p><p>Recently I ported my website to <a href="https://www.gatsbyjs.org/">GatsbyJs</a>. In my previous setup I already wrote my blog posts in markdown, but had a kind of self-built way of displaying those markdown files, which I wasn’t perfectly happy with. For those who don’t know GatsbyJs: It’s a static site generator, that is built on top of React and has a <a href="https://www.gatsbyjs.org/plugins/">ton of great plugins</a>, that are very easy to setup and use.</p><h3>The difference to Create-React-App</h3><p>So what’s the difference to the regular Create-React-App (CRA)? There is a great <a href="https://github.com/gatsbyjs/gatsby/issues/1458">GitHub issue</a> explaining the difference: Mainly that Gatsby is built on top of CRA, runs on GraphQL out of the box and has more build opinions. Further once you build your site with Gatsby, you’ll get a set of static sites rendered on the server instead of a dynamic application rendered on the client (you can also add server side rendering to CRA, but it’s not out of the box). CRA on the other hand is more open in how you handle data and is just a quick and easy way to get started with React without having too many pre-defined ways of how your application should be built.</p><h3>How I got started</h3><p>In order to understand, which part of my old application I should port into the new Gatsby setting, I first read the <a href="https://www.gatsbyjs.org/docs/">Quick-Start guide</a> and installed the Gatsby CLI npm install --global gatsby-cli. After exploring the basic starter you get when running gatsby new gatsby-site, I mainly looked through the code of various of the <a href="https://www.gatsbyjs.org/docs/gatsby-starters/">starters</a> to figure out which parts I needed an didn’t need and what I had to change in order to get the same experience I had now with the old redux setting. I decided to not use Redux anymore, since my portfolio website doesn’t have a lot of state and I really enjoy the simple Gatsby way of using the <a href="https://www.gatsbyjs.org/packages/gatsby-transformer-remark/">remark plugin</a> and writing page specific state into the markdown files and then querying it with GraphQL.</p><h3>The file structure</h3><p>When looking through various starters, I always found myself back in two main files: gatsby-config.js and gatsby-node.js, because they quickly tell you what’s happening in the project and what&#39;s built in. I decided to split my static pages markdown files and my blog post markdown files in two different folders called pages and posts. Those then will be rendered into the templates located into the templates folder. Markup that&#39;s valid for all pages goes into the layout/index.js file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*GFTA-la_qwyYmLlsbEr8SQ.png" /></figure><h3>gatsby-config.js</h3><p>The config file explains what plugins you’re using with what options. You can find my complete config here: <a href="https://gist.github.com/lisilinhart/5275b409ecd70838a8a3e8147f359279">Gatsby Config</a></p><p>The gatsby-source-filesystem plugin is essential to get your markdown files loaded. I created to seperate folders for my static pages and for my blog posts, with the name option name: &quot;pages” you’re later able to query your specific pages or posts files in GraphQL.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f289b839fe3e6cd9d614913676ca613/href">https://medium.com/media/9f289b839fe3e6cd9d614913676ca613/href</a></iframe><h3>gatsby-node.js</h3><p>The node file is where the magic happens. It’s where your markdown files and templates are loaded and where your different paths are created. In order for my site to work I needed to load different templates depending if the markdown file was in the posts or pages folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d2db02e78ba86ca43081f8ec1afea8c/href">https://medium.com/media/4d2db02e78ba86ca43081f8ec1afea8c/href</a></iframe><p>I also adapted the GraphQL remark query to filter for only posts or pages:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/400e4bf68bad43fdd4eccce8721f10cb/href">https://medium.com/media/400e4bf68bad43fdd4eccce8721f10cb/href</a></iframe><p>and then further down, when my pages were created I loaded the correct template depending on in which folder the markdown files was in.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0633979c155f2156fd6e3f69bc6b165/href">https://medium.com/media/e0633979c155f2156fd6e3f69bc6b165/href</a></iframe><h3>Working with Markdown and Remark</h3><p>Markdown is awesome and simplifies writing on the web a lot. If you haven’t used it yet, you can get started with this nice <a href="https://www.markdowntutorial.com/">markdown tutorial</a>. GatsbyJS makes it really easy to transform your markdown content into HTML structure using the <a href="https://www.gatsbyjs.org/packages/gatsby-transformer-remark/">remark plugin</a>. In order to make it work for your project there is a couple of things you need to consider.</p><h3>Location of markdown files</h3><p>You can have different locations for your markdown files, just specify where they are located in the gatsby-config.js for the gatsby-source-filesystem plugin.</p><h3>GraphQL</h3><p>Once you have your files setup, you can query your markdown files in GraphQL using either allMarkdownRemark for getting multiple markdown files or simply markdownRemark for getting a simple markdown file.</p><p>To get a specific markdown file you could do the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad981252a1eb8e151a8b5e6ffd1eefc0/href">https://medium.com/media/ad981252a1eb8e151a8b5e6ffd1eefc0/href</a></iframe><p>This would go through your markdown files and get the one, that has title: about set.</p><p>Or to get all markdown files located within your posts folder, you could do the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a23d61ef220f1b02e0df414d79d38540/href">https://medium.com/media/a23d61ef220f1b02e0df414d79d38540/href</a></iframe><h3>Animation</h3><p>For my website the main animation happens whenever we go to a new page. Since the component, that creates this animation is on all my pages, it is located in my layouts�/index.js file. In order for the component to receive this location change the only thing I had to add was a location prop, so I could add the animation on componentDidUpdate.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c57a47a2732d5c5a56b8ea64fd3c0de/href">https://medium.com/media/6c57a47a2732d5c5a56b8ea64fd3c0de/href</a></iframe><p>So in my Frame Component, whenever the location updated, my component updated and I added a simple CSS Class, which I removed again, after the animation had finished.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e0329f58867ab555518f8712b654721/href">https://medium.com/media/3e0329f58867ab555518f8712b654721/href</a></iframe><p>The animation itself is defined with styled components and CSS Keyframes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e867a84128dd1d8e520dc73e0e38c278/href">https://medium.com/media/e867a84128dd1d8e520dc73e0e38c278/href</a></iframe><p>and my Overlay had an animation class, which triggered the animation whenever the .animating class was added.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e047ab9f4b19a9e12c1fe8e793293a2/href">https://medium.com/media/0e047ab9f4b19a9e12c1fe8e793293a2/href</a></iframe><h3>Fade Out Transitions</h3><p>I haven’t added fadeOut transitions myself but there is a very handy gatsby plugin called <a href="https://www.gatsbyjs.org/packages/gatsby-plugin-page-load-delay">gatsby-plugin-page-load-delay</a> that delays the unmount of your component, which allows you to add animation on the componentWillUnmount lifecycle hook. By setting the window.pageExitTime = 1000 to the time of your animation, the next page will be mounted as soon as the animation is finished.</p><h3>Page Specific Animations</h3><p>If you have animations that aren’t specific to your entire layout, but only to one page, you can trigger these animations in the componentDidMount hook of the specific page. For my website this is the case with the different main color on the pages. My main color is defined as a CSS Variable on my document.body and whenever we’re going to a new page this is updated. Which color the page should have is defined in the markdown file of the page itself:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e066189843159491921b7fd1a41f66f6/href">https://medium.com/media/e066189843159491921b7fd1a41f66f6/href</a></iframe><p>And in my PageTemplate I’m setting the --main CSS Variable on my document.body, which updates the color for the body and all the children that use this variable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30c27ca2ac4366b679e5a94e66aa6832/href">https://medium.com/media/30c27ca2ac4366b679e5a94e66aa6832/href</a></iframe><p><em>NOTE</em>: In order to add new fields to the markdown files like I added the color field, you need to load the <a href="https://www.gatsbyjs.org/packages/gatsby-transformer-javascript-frontmatter/">gatsby-transformer-javascript-frontmatter</a> plugin and query the field in the GraphQL query of the template.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84f873a210131871ea71894702f5e855/href">https://medium.com/media/84f873a210131871ea71894702f5e855/href</a></iframe><p>The Overlay that is animated when we go to another page for example, has the background and a transition defined dependent on the --main CSS variable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7889580502f7290fe01b74b265ada5f3/href">https://medium.com/media/7889580502f7290fe01b74b265ada5f3/href</a></iframe><h3>Custom Components</h3><p>Something I find awesome and amazing is the ability to create custom components, that you can use within your markdown files like I did on my /work page:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c0433921ed4736a37bce4a294d0659d/href">https://medium.com/media/4c0433921ed4736a37bce4a294d0659d/href</a></iframe><p>There is a <a href="https://using-remark.gatsbyjs.org/custom-components/">great tutorial</a> on how to create these components and for me this allowed to have one single PageTemplate for all my static files instead of 5 different files likes index.js, work.js, writing.js, speaking.js. Then I just defined the page specific components within the markdown file.</p><h3>Deployment</h3><p>Once you finished the development of your Gatsby site you have different options to deploy your site. When you run gatsby build a public folder will be created within your project and you can just copy these static files via FTP to your server, but the best option for me is to add a continuous deployment, which rebuilds your site when you push changes to your GitHub repository.</p><h3>Deployment with CircleCI on your own webspace</h3><p>If you already own a webspace and don’t want to switch to something else a tool like <a href="https://circleci.com/">CircleCI</a> is free, if you don’t have tons of builds. It’s fairly easy to setup with an exisiting GitHub repository. Here is a <a href="https://gist.github.com/BaconSoap/b219d2e31b76fad494f8e9b508ca71df">simple circleCI setup</a> you can use for your Gatsby site. In order to use it, all you need is a ssh access to your webspace and to add your credentials for the deploy jobs command: scp -r public &quot;$SITE_SSH_USER@$SITE_SSH_HOST:/var/www/$PROD_URL/&quot;.</p><h3>Deployment with Netlify</h3><p>If you don’t have a webspace the easiest option is to use Netlify, because it integrates very nicely with GatsbyJS and you can even hook it up to NetlifyCMS, allowing you to have a CMS Editor for your static site. Steps for using Netlify to deploy your project:</p><ol><li>Create a Netlify Account</li><li>Upload your project to a public or private Github Repo</li><li>Grant Netlify Access to this Github Repo</li><li>Deploy</li><li>Add your custom domain (change the DNS settings to point to your netlify deployment)</li><li>Edit your Continuous Deployment Settings</li></ol><p>The process of creating a new site is very simple and straight forward in Netlify. Just connect your Github Repo and get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q3TgywwD59fYlV86_BYiVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2Zj4HYne-xau5YNkgGM_A.png" /></figure><p>Once you deployed your project you can point your domain to the netlify deployment, so you have a nice domain name for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IH5MaF3OldTaWmGwdpAIqw.png" /></figure><p>After everything is ready, you can edit your Continuous Deployment Settings to tell Netlify when it should rebuild your project. The basic settings are that your site is rebuilt whenever you push on master on your GitHub repo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*deHR2vNEzVdvr3vmxNl_bw.png" /></figure><h3>Conclusion</h3><p>In my opinion GatsbyJS is great in the following cases:</p><ul><li>if you use React and want to generate fast static sites</li><li>great markdown support with GraphQL</li><li>fairly simple continous deployment with Netlify</li><li>easy CMS integration with NetlifyCMS &amp; GraphQL</li><li>lots of great Gatsby Plugins, that automate build steps</li><li>great <a href="https://www.gatsbyjs.org/docs/">documentation</a> with guides for common patterns &amp; problems</li></ul><p><em>Originally published at </em><a href="https://gist.github.com/498a3aa9396c6f4b89f8a09c2a6c62e5"><em>gist.github.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f1434cbf28e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Principles of Mobile User Interfaces]]></title>
            <link>https://medium.com/swlh/principles-of-mobile-user-interfaces-94661cca7c16?source=rss-d044ac6b4b3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/94661cca7c16</guid>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[interaction]]></category>
            <dc:creator><![CDATA[Lisi Linhart]]></dc:creator>
            <pubDate>Sun, 14 Jan 2018 18:18:13 GMT</pubDate>
            <atom:updated>2018-01-16T22:00:38.455Z</atom:updated>
            <content:encoded><![CDATA[<p>Last year was the first time that mobile users topped desktop users on a worldwide scale. If we take a look at the <a href="https://www.w3counter.com/globalstats.php">global statistics</a> the leading screen resolution today is 640x360 with over 22%.</p><p>This shouldn’t be ignored and while responsive and mobile first development have been around for some time now, interaction in a mobile interface is very different to one in a desktop interface. With the rise of React Native and <a href="https://github.com/TalAter/awesome-progressive-web-apps">Progressive Web Apps</a> developing mobile user interfaces will also be a big part of Web Development in the coming years.</p><p>When developing mobile user interfaces, simplicity is essential for a good user experience. The interface should be consistent, avoid cognitive overload and disorientation in the user.</p><p>In order to satisfy and measure users interactions, 5 measurable principles have been devised <a href="https://doi.org/10.1016/j.procs.2016.08.014">in this paper</a>. This post will give a quick summary of these principles and look at some examples to outline aspects we should think about when creating mobile interfaces.</p><h3>Effectiveness</h3><p>Effectiveness describes how effective a user is while using an interface. The user has previous experience from other interfaces and the real world. In Human Computer Interaction (HCI) this is called a mental model the user is creating in order to comprehend complex concepts easier. We can increase the users effectiveness by benefitting from his knowledge gained from the real world. The goal of effectiveness is to reduce the <em>number of actions required to complete a task</em>.</p><h3>Some examples</h3><ul><li><a href="https://guitar-tuner.appspot.com/">This PWA</a> is a perfect example for using a mental model to increase the users effectiveness. By designing the digital tuner similar to how an analog tuner would look like, the user can immediately map this digital version of a tuner to his experience in the real world.</li><li>Use matching and known icons to reduce the cognitive load. Combine them with small labels to reduce wrong interpretation.</li><li>Another example for mental models would be a toggle to turn things on an off similar to a light switch in the real world</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MXtzftK4YzKibXHw.jpg" /></figure><h3>Efficiency</h3><p>Efficiency describes in what way the user can comprehend the <em>current state</em> of the application and the operations that can be performed. It is measured in <em>actions per second</em> and describes how efficient the user is in completing a task.</p><h3>Some examples</h3><ul><li>Give visual cues to where the user is located in the context of the interface. E.g. displaying view headlines, providing progress bars in forms, highlighting current tabs</li><li>If the interface is getting too complex, devise simple categories that subtasks can be assigned to. E.g. <em>Profile</em> for all user related data, <em>Collection</em> for saved items in the past, <em>Search</em> for dealing with new information.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tgmmkriJBcZqXtrq.jpg" /></figure><h3>Productivity</h3><p>Productivity describes how long a user takes to complete a task successfully. It also describes how easy it is for the user to <em>spot and identify functionalities</em> offered by an interface. It is measured in the number of actions needed to complete a task relative to time.</p><h3>Some examples</h3><ul><li>Reduce the need for typing by providing shortcuts to important tasks in the interface</li><li>Avoid misleading labelling, e.g. using the wrong icon</li><li>Provide error messages, so the user can recover from errors quickly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3wSOfOS7BxATMw8N.jpg" /></figure><h3>Error Safety</h3><p>Giving the user feedback is one of the most important parts of interface design. With appropriate feedback errors can be reduced significantly. We can measure Error Safety by counting <em>the number of errors committed in each action of each task</em>.</p><h3>Some examples</h3><ul><li>Provide appropriate feedback to user actions</li><li>Highlight important / new information</li><li>Provide tutorials or tooltips, which can be viewed when needed</li><li>Show the name of the current view / task / user</li><li>Give feedback when the user has committed an error or the system isn’t working as expected, e.g. form errors, alerts when something couldn’t be uploaded / handled</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z52Vxd5-_SwdxTPQ.jpg" /></figure><h3>Cognitive Load</h3><p>Reducing cognitive load in the user is essential to making an interface feel nice to use. We can do this by using metaphors for difficult concepts and keeping the interface simple in order not to confuse the user. A way of measuring cognitive load is by counting the <em>actions per view</em>.</p><h3>Some examples</h3><ul><li>Provide animation between view and context transitions, avoid rough cuts and confusing context changes</li><li>Use familiar and matching symbols to make the navigation and task completion easier for the user</li><li>Use logic flow to let the user complete a new task quickly</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KT1q1Ln48ybt9gQn.jpg" /></figure><h3>Conclusion</h3><p>When we design an user interface the focus of it’s design should always lie on if the interface is helping the user to fullfill the task he wants to complete. Some questions to ask yourself during the design of any interface are:</p><ul><li>Is my interface allowing the user to complete a task in the easiest way?</li><li>Is the interface reducing cognitive load by following simplicity and taking advantage of mental models?</li><li>Is the interface showing the user where he is located in it’s context, avoiding confusing states and disorientation?</li><li>Does the user get appropiate feedback to his actions?</li><li>Has the interface considered possible errors and provides feedback to these errors?</li></ul><p>Since mobile interfaces are very limited due to small screen sizes, it’s even more important to keep applications simple and focused on the tasks the user wants to complete. If the interface is getting too complex and confusing, it might be because it tries to fullfill to many diverse conditions and should actually be split in different applications. By keeping Effectiveness, Efficiency, Productivity, Error Safety and Cognitive Load in mind we can avoid building interfaces, that might look fancy but don’t actually support the user in his task completion.</p><h3>Resources</h3><ul><li><a href="https://doi.org/10.1016/j.procs.2016.08.014">Mapping HCI Principles to Design Quality of Mobile User Interfaces in Healthcare Applications</a></li><li><a href="https://github.com/TalAter/awesome-progressive-web-apps">Resources for Progressive Web Apps</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gfnVvkMRFtjVsWF7vkClA.png" /></figure><h4>This story is published in <a href="https://medium.com/swlh">The Startup</a>, Medium’s largest entrepreneurship publication followed by 285,454+ people.</h4><h4>Subscribe to receive <a href="http://growthsupply.com/the-startup-newsletter/">our top stories here</a>.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gfnVvkMRFtjVsWF7vkClA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94661cca7c16" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/principles-of-mobile-user-interfaces-94661cca7c16">Principles of Mobile User Interfaces</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advantages of the Web Animations API]]></title>
            <link>https://medium.com/@lisilinhart/advantages-of-the-web-animations-api-715bb3c0a780?source=rss-d044ac6b4b3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/715bb3c0a780</guid>
            <category><![CDATA[waapi]]></category>
            <category><![CDATA[javscript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[a11y]]></category>
            <category><![CDATA[web-animations-api]]></category>
            <dc:creator><![CDATA[Lisi Linhart]]></dc:creator>
            <pubDate>Fri, 06 Oct 2017 11:24:28 GMT</pubDate>
            <atom:updated>2017-10-06T11:24:28.980Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://lisilinhart.info/posts/waapi-advantages"><em>This has been cross-posted to my website.</em></a></p><p>While CSS Animation has gotten really powerful in the past few years, especially with the rise of CSS Variables, CSS will always be a <em>declarative</em> language while Javascript is <em>imperative</em>. So if you do an animation in CSS you have to specifically describe what is going to happen for every step, whereas in Javascript with the WAAPI you are more flexible, because you can programmatically define the animation in an animation object.</p><h4>WAAPI Animation controls</h4><p>The WAAPI let’s you reverse, pause, speed up your animations and gives you callbacks for when an animation has finished. These things are fairly hard to do in CSS , especially chaining multiple animations requires a lot of variables or specifying exactly when what it is going to happen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19ac181bf9c0260eea700c087368d776/href">https://medium.com/media/19ac181bf9c0260eea700c087368d776/href</a></iframe><h3>Styling vs. Behaviour</h3><p>The more interactive and complicated an animation gets in CSS, the more CSS tricks &amp; hacks you are going to need, which might make your CSS harder to read for other people. So for example of you have a div, that you want to fade out when you click on it, there would be three forward ways to do it.</p><h4>Pure CSS</h4><p>In order to do it in <a href="https://codepen.io/lisilinhart/pen/RLxKrQ">pure CSS</a> you would need a checkbox to register the click. Once the checkbox is :checked you could play the according CSS animation. This does however require another element on top of our original element.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea7675425e55b02aaf6a58f371b8c7d7/href">https://medium.com/media/ea7675425e55b02aaf6a58f371b8c7d7/href</a></iframe><h3>CSS Animation with class changes via JS</h3><p>What gotten quite popular in the past years is to start animations by <a href="https://codepen.io/lisilinhart/pen/KXqqyX">toggling an animation class</a> via Javascript. For this option you already need some Javascript to handle your events. Your animations however are still defined declaratively in CSS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0195ae20f618d4b5973075541d30cd9/href">https://medium.com/media/f0195ae20f618d4b5973075541d30cd9/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f91e90d98a37518c5c261dc40ccd0f3c/href">https://medium.com/media/f91e90d98a37518c5c261dc40ccd0f3c/href</a></iframe><h3>Animate in Javascript with the WAAPI</h3><p>With the Web Animations API you got a third option, in which you <a href="https://codepen.io/lisilinhart/pen/EwXvWx">define all of your animations in your Javascript</a>. This option allows you to take the animation behaviour out of your CSS and use CSS purely for styling, while still taking advantage of CSS hardware acceleration and rendering animations over the GPU.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cff647283f980ef03e61f8816a576012/href">https://medium.com/media/cff647283f980ef03e61f8816a576012/href</a></iframe><p>Nevertheless this doesn’t mean you have to abandon CSS animations. You still have the option to combine the two, when it makes more sense to do an animation in CSS, because of the simplicity.</p><h3>Hardware Acceleration</h3><p>In the past you would often prefer CSS Animation, because it gave you hardware acceleration and it could render properties like opacity or transform very performant over the GPU. But now you will also get this acceleration in the WAAPI, if the browsers already supports the Web Animation API.</p><h3>Tell the Browser what is animated</h3><p>When you use the Web Animations Api, all your animations will be described in the document.timeline and you (and the browser) have access to all the animations.</p><p>What’s a problem with external animation libraries is that the Browser sometimes doesn’t recognise elements that the library animates as elements that are animated and therefore they aren’t promoted to their own layer or rendered over the GPU. With the WAAPI we’re telling the Browser: “Hey Browser, I’m animating this element with the API you’re providing, can you please optimise it for me with what’s available to you?”</p><h3>It’s native</h3><p>The browser are already working hard on implementing the API and Firefox has large parts of it implemented already. This means you maybe won’t need to add an large external library to do some chained custom animations in the future.</p><p>Of course there will always be a need for libraries like Greensock, because they are aimed to do a lot more than the API (SVG morphing for example) and are easily understandable for developers and designers, but with the API you have a simpel native option to do more advanced animations without needing to add or learn a new library.</p><p>Since it’s not fully supported yet, there is a great <a href="https://github.com/web-animations/web-animations-js">polyfill</a> you can use and it <a href="https://github.com/web-animations/web-animations-js/blob/dev/docs/support.md#browser-support">supports all the major browsers</a> already, falling back to the native implementation if there is one.</p><h3>Animations in the document</h3><p>If you have all animations described in your document.timeline, you have easy access to all the animations that are happening on your site.</p><h3>Responsibility</h3><p>It’s a big problem that animations can be mentally taxing for people if they’re overdone or if they suffer from an illness like vestibular disorder (more in <a href="https://alistapart.com/article/designing-safer-web-animation-for-motion-sensitivity">this article</a>) . So providing an option to disable the animations is important. Since they are all in the document you can call getAnimations() on the document and cancel() them if needed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1159a2a5e49355b071b708b63ddcdd6e/href">https://medium.com/media/1159a2a5e49355b071b708b63ddcdd6e/href</a></iframe><h4>CSS can do this too</h4><p>There is also a great way to take care of this in CSS with CSS Custom Properties:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39ca40105d9ce4994c26dc0b39f776eb/href">https://medium.com/media/39ca40105d9ce4994c26dc0b39f776eb/href</a></iframe><h3>Interaction</h3><p>The WAAPI works hand in hand with Javascript DOM Events and creating more interactive, reactive animations.</p><p>Last week I created a <a href="https://codepen.io/lisilinhart/pen/rGwbwg">pen animating tiles</a> to reveal underlying text. It creates Tile function class, that creates an animation for each element in the grid gridItems.forEach((item) =&gt; new Tile(item)); .</p><p>Once the animation for this tile is created this.opacity = this.element.animate(..), it is immediately paused with this.opacity.pause(); and only played once the mouseover event is fired.</p><p>When we click the Reset Tiles button, I change the playbackRate of all the animations to -1 , which plays all the animations in reverse and animates them back in. I could have also called this.opacity.reverse() , which would have done the same thing.</p><p>This interaction was quite simple to create with the WAAPI, but would have required a lot of class changes on the DOM if I’d done it with CSS Animation. In this case working with the animation object turned out to be really useful and straight forward.</p><h3>Conclusion</h3><p>The Web Animations API definitely has an important place in the world of web animation, because it builds the basis for describing native animations across all browsers. It gives us a lot of new options like playback control, CSS hardware acceleration in JS and access to all animations in our document. It also let’s you put more complicated animation behaviour (e.g. chained timelines) in your Javascript, which in return can make your CSS simpler.</p><p>In conclusion there is many ways to animate on the web and the WAAPI is not the solution to all the animation challenges. There are really amazing pure CSS solutions for common problems and I recommend everyone to try to do animations in pure CSS, just because it can be really rewarding to dive deeper into CSS, because you really don’t always need Javascript. CSS is really powerful by itself. Just have a look at <a href="https://codepen.io/davidkpiano/pen/ByNPQw">David Khourshid</a>, <a href="https://codepen.io/una/pen/Wjvdqm">Una Kravets</a> or <a href="https://codepen.io/shshaw/pen/pWwrmM">Shaws</a> Codepens.</p><p>However when animations get more complicated and you want to have more control over your native animations, the WAAPI is going to be your friend. Javascript will give you a lot of flexibility, when you want to create dynamic values or handle DOM Events to make something more interactive.</p><h3>Resources</h3><ul><li><a href="http://danielcwilson.com/blog/2016/08/why-waapi/">Dan Wilson — When to Use the Web Animations API</a></li><li><a href="https://www.seguetech.com/animation-css-vs-javascript/">James Lee — Animation: CSS vs. Javascript</a></li><li><a href="https://alistapart.com/article/designing-safer-web-animation-for-motion-sensitivity">Designing Safer Web Animation For Motion Sensitivity</a></li><li><a href="https://goodstuff.fm/nbsp/131">Non Breaking Space Show — Rachel Nabors</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=715bb3c0a780" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>