<?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 Sean Mateer on Medium]]></title>
        <description><![CDATA[Stories by Sean Mateer on Medium]]></description>
        <link>https://medium.com/@sean_mateer?source=rss-c67715e3ddf9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*sbhm8b4blFW0n9_J.jpeg</url>
            <title>Stories by Sean Mateer on Medium</title>
            <link>https://medium.com/@sean_mateer?source=rss-c67715e3ddf9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:24:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sean_mateer/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[Framer For People Who Think Things Like Framer Are Weird And Hard]]></title>
            <link>https://medium.com/framer-prototyping/framer-js-for-people-who-think-things-like-framer-js-are-weird-and-hard-add2068c8114?source=rss-c67715e3ddf9------2</link>
            <guid isPermaLink="false">https://medium.com/p/add2068c8114</guid>
            <category><![CDATA[interaction-design]]></category>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[resources]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Sean Mateer]]></dc:creator>
            <pubDate>Thu, 30 Jul 2015 16:40:58 GMT</pubDate>
            <atom:updated>2018-01-04T15:03:57.922Z</atom:updated>
            <content:encoded><![CDATA[<p>A tutorial to help non-programmers get started with Framer.<br><em>Updated for Framer v72.</em></p><p>Thanks to Chris Coyier for the <a href="http://24ways.org/2013/grunt-is-not-weird-and-hard/#fn108098223952a968d2c6d4b">title inspiration</a> and great read that made me stop thinking things like Grunt were weird and hard.</p><h3>How to draw an owl</h3><p>The first time I looked at an example project in <a href="http://framerjs.com/">Framer Studio</a>, it felt like the “How to draw an owl” instructions. I played around with the demos and browsed the documentation, but quickly gave up, thinking the learning curve was too steep and I didn’t have the time to devote.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*ps1LThoFav5Joqyd1mPAyg.jpeg" /><figcaption>“A fun and creative guide for beginners.”</figcaption></figure><p><em>It was too weird and hard.</em></p><p>Since then, I had tried <a href="https://atomic.io/">many</a> <a href="http://www.relativewave.com/form.html">other</a> <a href="http://www.pixate.com/">prototyping</a> <a href="https://facebook.github.io/origami/">tools</a>, but they either didn’t have the functionality I desired at the time, or also had fairly steep learning curves.</p><p>In an act of desperation and frustration, I gave Framer another try. Much to my surprise, it wasn’t long l before I’d created some semblance of a completed owl.</p><h3>To Framer, or not to Framer?</h3><p>If you’ve already got a favorite prototyping tool that works for you and your workflow, I won’t try to sway you into using Framer (also, what tool is it?). I was only compelled to share my experience with Framer after my perception of its weirdness and difficulty was <a href="https://www.youtube.com/watch?v=AVbQo3IOC_A">turned upside down</a>.</p><h4>But CoffeeScript is scary</h4><p>CoffeeScript is a language the compiles into JavaScript, just like Sass or Less into CSS.</p><p><em>Another layer of abstraction beyond JS? Are they trying to make this even harder?</em></p><p>You might think you need to be a JavaScript expert to use Framer, but in reality, Framer is doing a lot of the hard work by providing awesome documentation and familiar properties to interact with your design. CoffeeScript does you an additional favor and gets rid of all the icky JS syntax, so you can concentrate on making an amazing prototypes.</p><p>Many of the properties used in Framer are exactly the same, or extremely similar to CSS properties. If you know basic CSS, Framer shouldn’t be too scary.</p><p>For example, here’s how you can make a circle with CSS.</p><pre>// A circle in CSS</pre><pre>.circle {<br>  width: 200px;<br>  height: 200px;<br>  border-radius: 100px;<br>  background-color: red;<br>}</pre><p>Here’s how you can make one in CoffeeScript with Framer.</p><pre># A circle in CoffeeScript with Framer</pre><pre>circle = new Layer <br>  width: 200<br>  height: 200<br>  borderRadius: 100<br>  backgroundColor: “red”</pre><p>Suspiciously similar, isn’t it? Just for comparison, here’s what that CoffeeScript looks like when it’s compiled into JavaScript.</p><pre>// Icky complied JS we don&#39;t care about</pre><pre>(function () {<br>  var circle;<br>  circle = new Layer({<br>    width: 200,<br>    height: 200,<br>    borderRadius: 200,<br>    backgroundColor: ‘red’<br>  });<br>}.call(this));</pre><p>Gross. That just seems complicated and full of syntax. Lucky us, we will never need to look at the compiled JS.</p><h4>“If I’m going to go to that much work, I might as well just build it.”</h4><p>This is something I’ve heard quite a bit from friends and colleagues, and have been guilty of thinking myself. But ask yourself: are <em>you</em> going to <em>actually </em>build it (kudos), or are you going to end up trying to explain an intricate interaction to a developer and be upset when it isn’t built how you imagined?</p><p>If you want to accurately communicate <em>high-fidelity </em>interactions, a verbal description or napkin sketch isn’t going to cut it. After all, this is what you are an expert in — it’s worth learning how to use the tools that communicate your expertise.</p><p>Whether it’s Framer or another weird and hard prototyping tool, with a little bit of investment time you’ll be quickly slinging out prototypes and everyone will ❤ you, including your end users for giving them an intuitive and delightful experience.</p><h3>Enough talk, let’s make the owl</h3><p>As an intro to Framer, we’ll walk though making <a href="http://share.framerjs.com/gfsk63r3drg7/">this draggable onboarding demo</a> using elements from InVision’s Sketch <a href="http://www.invisionapp.com/do">to-do app ui kit</a>. If you’re brand new to both Sketch and Framer, you can expect this tutorial to take roughly 30–45 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-mwdolKCFDsMoWqbZ831A.png" /><figcaption>Our end results will look something like this.</figcaption></figure><p>If you haven’t yet, download <a href="http://framerjs.com/">Framer</a> and the <a href="https://drive.google.com/file/d/0BxTjE-3b5-pKbzVZMEZnUHdvSjQ/view?usp=sharing">Sketch file</a> we’ll be working with.</p><h4>Import the Design and Choose a Device</h4><p>Framer will automatically import your design from Sketch. You can make updates and re-import whenever you want. Let’s start by importing the file provided. Open a new file in Framer Studio, click import, and select ‘@1x’ from the dropdown before importing. (Sketch and the project you wish to import must be open).</p><p><em>In the latest versions of Framer, you can import Sketch files at increased resolutions. Since our Sketch artboard is already designed at 2x for an iPhone 6/7 (750 x 1334) we should import it at 1x so that it isn’t further scaled.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWxnSGd1jo_a87lGidRFmg.gif" /><figcaption>Make sure your Sketch file is open and saved so Framer can find it.</figcaption></figure><p>The newest version of Framer offers even more device types for displaying your prototypes in. Make sure that your device is set to an iPhone 6 or iPhone 7 so that the imported sketch design scales correctly.</p><pre>sketch = Framer.Importer.load(&quot;imported/framerOnboard&quot;)</pre><p>Cool. The bit of code Framer generated lets us know that our Sketch layers have been turned into an object that we will be able to reference. We’ll talk more about that soon. You’ll see the folder structure of the Sketch file directly to the right of the code. If you roll over items, you’ll see them highlighted in the device and useful information like their positions and sizes displayed.</p><p>You’ll also likely see a comment above the import code that Framer generated:</p><pre># Import file &quot;framerOnboard&quot;</pre><p>The ‘#’ designates that the text following it is a comment. You can create your own comments in Framer by typing ‘#’. You can also highlight existing text and comment it out by pressing <em>cmd and / (</em>forward slash)<em>. </em>The import comment isn’t necessary, so you can delete it if you’d like.</p><p>To make it easier to reference the Sketch layers we want in Framer with code, you can change the name of the variable referencing the Sketch layers. I like to use a dollar sign because it is unique in the Framer environment, much quicker to type than ‘sketch’, and because $$$.</p><pre>$ = Framer.Importer.load “imported/framerOnboard@1x”</pre><h4>Set up initial states</h4><p>Our first card is right where we want it, but the second and third cards are directly behind it. Let’s set up an initial state for our second card. Since we made a reference to all of the layers with <em>$ </em>(or whatever variable you used)<em>, </em>we can access any specific layer name through dot notation. Adding another dot and a property name lets us change the value of that property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*4bxWCm3YEYR0ggFYb4ulXA.png" /></figure><p>In our Sketch file, the layer <em>placeholder2 </em>has a position x = 700 and y = 300. Let’s set <em>card2</em> to the same position in Framer by typing the following code:</p><pre>$.card2.x = 700<br>$.card2.y = 300</pre><p>You should see Framer update in real time. Our card2 is now 700 px from the left, and 300 px from the top.</p><p>Next, hide the placeholder cards using the opacity property. The placeholder cards are ultimately unnecessary to the design, but served as a reference in the Sketch layout for where we want to dynamically place our inactive cards. Additionally, set the opacity of card3 to zero, we’ll deal with that later.</p><pre>$.placeholder1.opacity = 0<br>$.placeholder2.opacity = 0<br>$.card3.opacity = 0</pre><p>Now let’s scale our inactive <em>card2</em> down like it is in the Sketch layout. The default <a href="http://framerjs.com/docs/#layer.scale">scale</a> property is set to 1, so let’s size it down just a bit to 0.85.</p><pre>$.card2.scale = 0.85</pre><p>Bummer, looks like <em>card2</em> may have disappeared off the screen. This is because by default, all objects scale from the center — just like when you hold <em>shift + opt</em> to resize something in Photoshop or Sketch. Let’s have our card scale with its origin at the left and top instead.</p><pre>$.card2.scale = 0.85<br>$.card2.originX = 0<br>$.card2.originY = 0</pre><p>The <a href="http://framerjs.com/docs/#layer.originX">originX and originY</a> properties tell us which side of the object we want to scale, rotate and skew from, <a href="https://css-tricks.com/almanac/properties/t/transform-origin/">just like transform-origin in CSS</a>. originX and originY can have a value between 0 and 1 and have a default value of 0.5. Below is an example of how you can think about how origins effect the direction an object scales in relation to how you might resize something in Sketch or Photoshop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*RuRtJsr0pGn32eCpEwCqng.gif" /><figcaption>Here’s how you can think about object origins in relation to scaling objects in Sketch or Photoshop.</figcaption></figure><h4>Getting some motion on</h4><p>Let’s set the position of where we want <em>card1</em> to move when it is interacted with. We’ll add a <em>state</em> to <em>card1</em> and a <em>click</em> event handler right away, and then talk about what they’re doing specifically.</p><blockquote><strong>Note:</strong> CoffeeScript forgoes the curly brackets and semicolons used by JavaScript for whitespace, so indention is crucial or your code will not work. Be sure to be consistent in your indention length, whether using spaces, or a tab. (If you are copying from Medium, you’ll get four spaces, which equals the width of a tab in the Framer IDE).</blockquote><pre># Add a state to card1<br>$.card1.states =<br>    two: x: -510, y: 300, scale: 0.85, originX: 1, originY: 0</pre><pre># Add a click event listener<br>$.card1.onClick -&gt;<br>    $.card1.animate(&#39;two&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*t-NTE95n_lI2C21zib58Dg.gif" /><figcaption>Bye card. We’ll make you come back in a few more steps.</figcaption></figure><p>First, we added a new <a href="https://framerjs.com/docs/#layer.states"><em>state</em></a> to our <em>card1</em> layer<em>. </em>I called the state <strong>two</strong>, but you can call it whatever you want. The state <strong>two</strong>, when active, applies new x and y coordinates to <em>card1</em>. It also scales the card, just like how <em>card2</em> is scaled on its initial state.</p><p>Second, we added an <em>onClick</em> <a href="https://framerjs.com/docs/#events.events"><em>event</em></a> that listens for <em>card1</em> to be clicked, so it can then do anything we’ve designated. In this case, we instruct card1 to animate to state<strong> two, </strong>but only <em>onClick.</em></p><p>Now we can click <em>card1</em> to apply the state <strong>two</strong>.<em> Oooh motion</em>! Framer automatically applied default animation speed and timing and also tweened between the properties. Let’s override the default animation with a custom one. Hit <em>cmd</em> + <em>R</em> to refresh the prototype if you haven’t already.</p><p>Add this animation option right below where you declared the state for <em>card1</em>:</p><pre>$.card1.states.animationOptions = curve: &#39;spring(200, 20, 0)&#39;</pre><p>Framer has a lot of animation timing options, including bezier-curves, which are more common with CSS animations. You can <a href="http://framerjs.com/docs/#animation.curve-types">explore the animation documentation</a>, and tweak the type and timing attributes to your liking.</p><p>Next, let’s add a second state for <em>card2, </em>just like we did for<em> card1. </em>Then, add an onClick event for <em>card2 </em>that returns the cards to their default state. <strong>Default </strong>is a state created for us by Framer that refers to the layer’s original properties before any other states were applied. We specify <strong>default </strong>as the state to animate for the <em>onClick</em> event of <em>card2</em> in order to return the cards to their original coordinates.</p><pre>$.card2.states =<br>    two: scale: 1, x: 94, y: 268, originX: 0, originY: 0<br>$.card2.states.animationOptions = curve: &#39;spring(200, 20, 0)&#39;<br></pre><pre>$.card1.onClick -&gt;<br>    $.card1.animate(&#39;two&#39;)<br>    $.card2.animate(&#39;two&#39;)</pre><pre># Return cards to their default state when card2 is clicked<br>$.card2.onClick -&gt;<br>    $.card1.animate(&#39;default&#39;)<br>    $.card2.animate(&#39;default&#39;)</pre><p>Wahoo. We should now be able to click both cards to have them swap positions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6Bb_VUP6hzx-nqgw3fFUQ.png" /><figcaption>At this point, your code should be looking something like this. Order may or may not effect your outcome, but organization is useful as your project becomes more complex. Following a pattern of defining Layer Properties, States, and then Events in order will generally prevent any errors from occurring.</figcaption></figure><h4>Make it Draggable</h4><p>If you haven’t already, download the <a href="https://itunes.apple.com/app/id1124920547">Framer App</a> to try the prototype on your phone. Clicking isn’t necessarily what you’d expect as the user input here, especially on a phone, so let’s make our cards draggable instead.</p><p>Enable <a href="https://framerjs.com/docs/#layer.draggable">dragging</a> on <em>card1</em> and <em>card2</em>:</p><pre>$.card1.draggable.enabled = true<br>$.card2.draggable.enabled = true</pre><p>Uh oh! If you swipe hard enough and don’t register a “click” our cards will fling off the screen. We’ll fix this in the next few steps.</p><p>We really only want cards to be dragged horizontally here, so let’s disable the ability for a user to drag them vertically. While were at it, let’s change our event handlers from listening for a <em>Click </em>to a <em>drag</em>. Specifically, when a user stops dragging the object with on<em>DragEnd.</em></p><pre>$.card1.draggable.vertical = false<br>$.card2.draggable.vertical = false</pre><pre># Change our event handlers from &#39;Click&#39; to &#39;DragEnd&#39;<br>$.card1.onDragEnd -&gt;<br>    $.card1.animate(&#39;two&#39;)<br>    $.card2.animate(&#39;two&#39;)</pre><pre>$.card2.onDragEnd -&gt;<br>    $.card1.animate(&#39;default&#39;)<br>    $.card2.animate(&#39;default&#39;)</pre><p><strong>UPDATED:</strong> We should also disable the <a href="https://framerjs.com/docs/#layer.draggable.momentum">momentum</a> on our draggable cards. This is an option enabled by default for draggable layers. However, when animating with states it can cause some unintended glitchiness, so it should be set to false.</p><pre>$.card1.draggable.momentum = false<br>$.card2.draggable.momentum = false</pre><p>Okay, we made the cards draggable and changed our events to listen for when a user stops dragging, but right now the cards swap even if you only drag a tiny bit. Let’s use an <em>if statement</em> to check how far a user drags. We only want to move to the next state if it looks like they made conscious effort to swipe.</p><p>Let’s look at the logic we want to write in pseudo-code:</p><pre>When the user finishes dragging<br>   Check if card1 is less than 15 px from the edge of the device<br>      If so, switch to state two for card1 and card2<br>   Otherwise (else)<br>      Leave the cards in their default position</pre><p>And below is what it looks implemented. Add these lines and indentation to the card1.onDragEnd event.</p><pre>$.card1.onDragEnd -&gt;<br>    if $.card1.x &lt; 15<br>        $.card1.animate(&#39;two&#39;)<br>        $.card2.animate(&#39;two&#39;)<br>    else<br>        $.card1.animate(&#39;default&#39;)<br>        $.card2.animate(&#39;default&#39;)</pre><p>With this code implemented, state <strong>two</strong> no longer activates if the user swipes to the right. If you only slightly swipe <em>card1</em> to the left, it will also not trigger. You can adjust the 15px to dial in the level of tolerance you like.</p><p>Now implement a similar setup on <em>card2</em>:</p><pre>$.card2.onDragEnd -&gt;<br>    if $.card2.x &gt; 160<br>        $.card1.animate(&#39;default&#39;)<br>        $.card2.animate(&#39;default&#39;)<br>    else <br>        $.card1.animate(&#39;two&#39;)<br>        $.card2.animate(&#39;two&#39;)</pre><p>This time we look for when the left edge of card 2 is <em>greater than </em>160px from the left edge of the screen.</p><h4>Finishing touches</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*bjoYLBhuXw2bV0Dy7z5O1Q.gif" /><figcaption>Currently, card2 goes under our card1 when dragged.</figcaption></figure><p>We have some z-indexing problems going on. First, use the <em>z </em>property to set the z index of our cards to 1 near the top of our file. This will ensure the cards are set to a z-index of 1 when they are in their default states:</p><pre>$.card1.z = 1<br>$.card2.z = 1</pre><p>Next, add z: 2 t0 the end of <strong>two </strong>states, for both <em>card1</em> and <em>card2</em> so they will overlay each other when active.</p><pre>two: scale: 1, x: 94, y: 268, originX: 0, originY: 0, z: 2</pre><p>Last but not least, let’s add the active state on the navigation. Since we didn’t make an active layer in Sketch, we’ll make it in Framer. Create a <a href="https://framerjs.com/docs/#layer.layer">new layer</a> called <em>activeDot</em> and give it some initial properties:</p><pre>activeDot = new Layer<br>   width: 20<br>   height: 20<br>   x: 314<br>   y: 1248<br>   borderRadius: 20<br>   backgroundColor: &#39;#6563A4&#39;</pre><p>Add a state t0 <em>activeDot</em> and set animation timing:</p><pre>activeDot.states =<br>   two: x: 367<br>activeDot.states.animationOptions = curve: &#39;spring(400, 20, 0)&#39;</pre><p>Then we just need to add the <em>activeDot</em> states to our events.</p><pre>$.card1.onDragEnd -&gt;<br>    if $.card1.x &lt; 15<br>        $.card1.animate(&#39;two&#39;)<br>        $.card2.animate(&#39;two&#39;)<br>        activeDot.animate(&#39;two&#39;)<br>    else<br>       $.card1.animate(&#39;default&#39;)<br>       $.card2.animate(&#39;default&#39;)</pre><pre>$.card2.onDragEnd -&gt;<br>    if $.card2.x &gt; 160<br>        $.card1.animate(&#39;default&#39;)<br>        $.card2.animate(&#39;default&#39;)<br>        activeDot.animate(&#39;default&#39;)<br>    else <br>        $.card1.animate(&#39;two&#39;)<br>        $.card2.animate(&#39;two&#39;)</pre><h3>Voila</h3><p>If you’re having trouble or want to compare, you can download the prototype with everything we’ve covered so far by clicking ‘open’ or the download button here: <a href="http://share.framerjs.com/gfsk63r3drg7/">http://share.framerjs.com/gfsk63r3drg7/</a></p><h4>Adding more cards and refactoring</h4><p>I won’t go through the details of adding the third card and doing a bit of refactoring of our code in this tutorial, as it’s a lot of repetition. For now, you can <a href="http://share.framerjs.com/mearmcsy9b6k/">view an example with the third card</a> added or feel free to <a href="https://twitter.com/Sean_Mateer">ask me</a> if you have questions.</p><h4>Was it weird and hard?</h4><p>What do you think of using Framer as a prototyping tool? Do you have another prototyping tool that you prefer? Let me know if you think any aspects of this walkthrough or example can be improved — I’m still learning too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=add2068c8114" width="1" height="1" alt=""><hr><p><a href="https://medium.com/framer-prototyping/framer-js-for-people-who-think-things-like-framer-js-are-weird-and-hard-add2068c8114">Framer For People Who Think Things Like Framer Are Weird And Hard</a> was originally published in <a href="https://medium.com/framer-prototyping">Framer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>