Slide 1

Slide 1 text

PROTOTYPING WITH FRAMER A workshop for designers by @stakelon

Slide 2

Slide 2 text

HI THERE

Slide 3

Slide 3 text

JAY STAKELON VP Product Design @Fullscreen ! ! ! ! ~10 years experience design, web engineering, product management, startups @stakelon

Slide 4

Slide 4 text

GET THE MATERIALS & FOLLOW ALONG h p://bit.ly/framerworkshop

Slide 5

Slide 5 text

WHY PROTOTYPING?

Slide 6

Slide 6 text

Concept & develop what you’re building. Build shared understanding of products. Get real feedback & validate your work.

Slide 7

Slide 7 text

h p://www.google.com/design/spec/material-design/introduction.html Motion provides meaning.

Slide 8

Slide 8 text

Designers define not just how interfaces look, but also how they react and adapt to user input. Static mockups only get halfway there. Touch devices continue to allow for greater and greater expression through gesture and motion. Animation can literally make users perceive your interfaces as faster, more responsive and more pleasant to use. CONCEPT & DEVELOP YOUR IDEAS Disney’s 12 principles of animation, applied to UI design
 h p://www.smashingmagazine.com/2012/10/30/motion-and- animation-a-new-mobile-ux-design-material/

Slide 9

Slide 9 text

Get out of the deliverables business. h p://www.flickr.com/photos/64519085@N00/4305366199/ Jeff Gothelf h p://www.smashingmagazine.com/2011/03/07/lean-ux-ge ing-out-of-the-deliverables-business/

Slide 10

Slide 10 text

Don’t struggle to find the right words. Instead, literally put your designs into the palms of your teams’ hands. In addition to (or instead of) sharing mockups and wireframes, prototypes act as living documentation. Instead of burning through design-engineering cycles to dial in the feel of an interface, get it dialed in on your own. CREATE SHARED UNDERSTANDING

Slide 11

Slide 11 text

Ideas are cheap. Building things is expensive. h p://www.cashcats.biz/

Slide 12

Slide 12 text

You can use prototypes to prove, or disprove, an idea cheaply and quickly compared to building and shipping production so ware. For user testing—whether usability/task completion or overall concept validation—high-fidelity prototypes can be almost as good as the real thing. GET FEEDBACK & VALIDATION

Slide 13

Slide 13 text

WHY FRAMER?

Slide 14

Slide 14 text

BUILT FOR DESIGNERS ➡ Export directly from Photoshop or Sketch to a Framer project.

Slide 15

Slide 15 text

NEAR-REAL-TIME Framer Studio minimizes the feedback loop between code and visual context.

Slide 16

Slide 16 text

IT’S JUST JAVASCRIPT Javascript is the language of the modern web. Coffeescript is a language that compiles to Javascript, but arguably has a cleaner and easier-to-learn syntax. Get into Coffeescript
 h p://coffeescript.org/
 h p://www.codeschool.com/courses/coffeescript

Slide 17

Slide 17 text

WHEN TO USE FRAMER Framer shines for native-feeling animations and complex interactions. Framer works incredibly well for prototyping mobile interactions and seeing how they work directly on the device. Framer’s not necessarily what you’d use to string together flows, to test information architecture or to prototype an entire website. Use an application prototyping tool like InVision, Axure or even Keynote. Use Framer in conjunction with application prototyping tools if you want higher fidelity for detailed interactions or UI elements.

Slide 18

Slide 18 text

Framer Examples

Slide 19

Slide 19 text

MOBILE PROTOTYPING Framer is awesome for prototyping mobile UIs with native-feeling interactions. Present prototypes on your laptop or interact with them directly on the device.

Slide 20

Slide 20 text

TABLET & MULTITOUCH Framer allows designers to create prototypes for any touch device. Add a library like hammer.js for advanced touch interactions. Since it’s just Javascript you can mix in other libraries and create your own.

Slide 21

Slide 21 text

WEB PROTOTYPING Though a less commonly-discussed use case, designers use Framer to prototype web apps and desktop interfaces.

Slide 22

Slide 22 text

SO MANY MORE “OFFICIAL” EXAMPLES AT h p://examples.framerjs.com/

Slide 23

Slide 23 text

THE WORKSHOP

Slide 24

Slide 24 text

RESPONSIVE INTERACTION BASIC ANIMATION WHAT WE’LL BUILD APP PROTOTYPE

Slide 25

Slide 25 text

THE EXERCISES Each lesson has an exercise. One lesson has two! Most lessons include .psd and Sketch files for reference. All of them include the solution (suffixed -solution). Don’t use the solutions unless you’re stuck :) Lessons 2 and onward include starter projects (suffixed -exercise) that have code comments providing hints, and the stuff you’ve already learned completed for you. You can start here rather than generating a new project from the .psd.

Slide 26

Slide 26 text

DOWNLOAD THE EXERCISES h p://bit.ly/framerexercises

Slide 27

Slide 27 text

LESSON 1 HELLO, FRAMER

Slide 28

Slide 28 text

FRAMER STUDIO

Slide 29

Slide 29 text

ERRORS & THE INSPECTOR Framer Studio highlights problematic code in red and prints error messages in the lower le For superpowers, click the icon in the lower le to open the Web Inspector. Use the Console to debug and to console.log

Slide 30

Slide 30 text

LAYERS “A layer is just a rectangle that draws stuff in the browser” - Framer Docs Shortcut: create an image layer by dragging any .png file into the Preview panel Layers can live inside other layers. A Layer’s position is relative to its superLayer BigSquare BigSquare LittleSquare LittleSquare.superLayer # BigSquare! BigSquare.subLayers[0] # LittleSquare

Slide 31

Slide 31 text

PROPERTIES Set properties when you initialize a new 
 Layer, or anytime a erwards Framer docs list ‘em all, including sexy
 filters (yes, blur) and shadows # Commonly used properties include! MyLayer = new Layer! # Positioning! x: 100! y: 100! # Size! height: 500! width: 500! scale: 1! # Visual! visible: true! opacity: 1! rotation: 0! backgroundColor: '#333'! clip: true! # Hierarchy! superLayer: VideoContainer

Slide 32

Slide 32 text

EVENTS You’ll always use this one
 Events.Click (it’s the same as Events.TouchEnd and triggered if a user clicks or taps) Standard DOM events
 Events.MouseOver, Events.MouseOut Touch events
 Events.TouchStart, Events.TouchMove, Events.TouchEnd Drag events
 Events.DragStart, Events.DragEnd, Events.DragMove And more events for scrolling, animation start/stop/end, and states switching Events are things that happen to layers, o en caused by user interaction

Slide 33

Slide 33 text

LISTENING FOR EVENTS # Listen for an event with Layer.on! BlueBox.on Events.Click, (evt)->! # Perform the actions below when the event occurs! BlueBox.opacity = .5! BlueBox.x = evt.x + 100 # Move BlueBox 100px to the right ✋

Slide 34

Slide 34 text

EXERCISE 1: INTRO Create a new Framer project. Import the three .png files in the IntroImages folder into Framer by dragging them into Framer’s preview pane on the right. Lay them out using their x and y properties. Hide the Heart layer when you click on it by listening for Events.Click. Extra credit
 Make the Heart a subLayer of the Card layer using the superLayer property.

Slide 35

Slide 35 text

PREVIEWING View in Framer’s presentation mode or use the prototype directly on your device If you’re working with @2x images make sure that you adjust the viewport meta tag in the autogenerated index.html file to initial-scale=0.5 initial-scale=0.5

Slide 36

Slide 36 text

PREVIEWING Using Dropbox public folder is a simple way to get prototype to the device. Codekit and Cactus are two other solutions On iOS devices use Clear Browser to run your prototype ▻ ▻ UPLOAD FRAMER PROJECT TO YOUR PUBLIC FOLDER OPEN THE PUBLIC LINK IN CLEAR BROWSER IT’S ALL 
 GOOD

Slide 37

Slide 37 text

LESSON 2 ANIMATION BASICS Also includes Generating From Photoshop/Sketch

Slide 38

Slide 38 text

GENERATING Import your Photoshop or Sketch docs directly to Framer Studio Use layer sets or groups to organize your mockup

Slide 39

Slide 39 text

PHOTOSHOP & SKETCH Every layer set or group becomes a Framer Layer Name each layer uniquely or Framer will do it for you (and you won’t like it) If a layer set or group’s visibility is off, it won’t export to Framer

Slide 40

Slide 40 text

IMPORTED LAYERS Refer to imported Layers by the name you gave the layer set or group Declu er the view by hiding Layers that you don’t initially need # Framer will import generated layers and load them into an object! # I change the object's name to just "Layers" for simplicity! Layers = Framer.Importer.load "imported/AnimationBasics"! ! # These are both references to the PhotoCard! Layers["PhotoCard"]! Layers.PhotoCard! ! # Both of these will hide the layer from view! # visible = false will hide the layer and it won't receive events! Layers.PhotoCard.visible = false! # opacity = 0 will hide the layer but it will still receive events! Layers.PhotoCard.opacity = 0

Slide 41

Slide 41 text

ANIMATING LAYERS # A more detailed animation, ! # written out the "long way"! myLayerAnimation = new Animation! layer: MyLayer! properties:! opacity: 1! x: 200! curve: 'spring-rk4'! curveOptions:! tension: 150! friction: 15! velocity: 5! time: .25! delay: .25! Animation.start() # An animation that uses the! # Layer.animate shorthand! MyLayer.animate! properties:! opacity: 1! time: .25! curve: 'ease-in-out' Layer.animate is the quickest way to create and run an animation

Slide 42

Slide 42 text

BASIC CURVES The default animation curve is “linear” Other defaults: “ease”, “ease-in”, “ease-out”, “ease-in-out” Use springs and bezier curves for finer-grained control LINEAR EASE EASE-IN EASE-OUT EASE-IN-OUT

Slide 43

Slide 43 text

EXERCISE 2a: BASIC ANIMATION Create a new Framer project and generate layers from AnimationBasics.psd. Hide the Heart layer by making it transparent. When the user clicks on the now-hidden Heart layer, fade it in using an animation. Use the “ease-in-out” curve and run the animation over .25s.

Slide 44

Slide 44 text

BEST PRACTICES Try to keep animations shorter than .5 seconds A good default for bu on animations and direct responses is .25 seconds Transitions between views can go longer Generally “linear” animations feel stilted; use “ease” or “ease-in-out”

Slide 45

Slide 45 text

USING THE STATE MACHINE States can help manage Layers that have multiple positions and sizes There’s always a default state that reflects the Layer’s initial properties # Add a few states to a layer! MyLayer.states.add! stateOne: { opacity: .5, x: 200 }! sdf: { opacity: 1, x: 400 }! # Specify how the animations should look! MyLayer.states.animationOptions =! curve: 'ease'! time: .25! # Animate to stateOne! MyLayer.states.switch ‘stateOne'! # Animate the layer to the next state! MyLayer.states.next() default stateOne secondState

Slide 46

Slide 46 text

Open StateMachine-exercise.framer in Framer Studio. The Heart layer’s opacity is set to 0 by default. Use states to specify an on state for the Heart layer that sets opacity to 1. Use states.animationOptions to specify an animation curve and timing. Toggle between the two states on click by using states.next(). The heart should fade in and out alternately when you click it. Extra credit
 Add user delight by pulsing the heart’s outline (the Outline layer) when you like and unlike the photo. EXERCISE 2b: STATES

Slide 47

Slide 47 text

LESSON 3 DRAGGING & ANIMATION CURVES

Slide 48

Slide 48 text

DRAGGING ✋ # One line of code makes any Layer draggable.! # Click or tap and drag the Layer, and it will! # remain where you release it.! BlueBox.draggable.enabled = true

Slide 49

Slide 49 text

DRAG EVENTS Remember, dragging emits events when the user starts and stops, as well as while the Layer is being dragged Events.DragStart ✋ Events.DragEnd Events.DragMove Events.DragMove Events.DragMove

Slide 50

Slide 50 text

BEZIER CURVES & SPRINGS Use these curves to create expressive 
 animations that can feel natural or exaggerated Omit the time property when you use springs The best way to learn how bezier curves work
 h p://cubic-bezier.com Play with Framer spring animations and bezier curves
 h p://stakes.github.io/framerplayground MyLayer.animate! curve: 'bezier-curve'! curveOptions: [.25, 1, .25, 1]! time: .25! ! MyLayer.animate! curve: 'spring-rk4'! curveOptions:! tension: 150! friction: 15! velocity: 5! ! MyLayer.animate! curve: 'spring-dho'! curveOptions:! stiffness: 150! damping: 10! mass: 1! velocity: 0

Slide 51

Slide 51 text

Make both thumb images invisible and enable dragging for the PhotoCard layer. Use Events.DragEnd to reset the PhotoCard layer back to its original position when it’s released. Hint: note the custom addition of an originalFrame property that stores the original properties on the layer itself. Animate the PhotoCard layer using the “spring-rk4” animation curve. Extra credit
 Use Events.DragStart to provide an affordance that implies that the card is draggable. Either scale the card down or up slightly when the user touches it. EXERCISE 3: DRAGGING

Slide 52

Slide 52 text

LESSON 4 RESPONSIVE UI Also includes Coffeescript Concepts

Slide 53

Slide 53 text

VARIABLES Variables let you store something by name. They’re containers for information If you try to get the value of a variable that doesn’t exist, it returns undefined You’ve been using variables this whole time! The Layers object, for instance

Slide 54

Slide 54 text

FUNCTIONS A function is a reusable block of code that takes input and generates output Create functions to run code later, or to do something multiple times setPosition = (newX)->! BlueBox.animate! properties:! x: newX! ! setPosition(300)! setPosition(600) setPosition(300) setPosition(600) More about functions in Coffeescript
 h p://coffeescript.org/#literals

Slide 55

Slide 55 text

CONDITIONALS Use if, else if and else to define your prototype’s logic and to perform different actions depending upon conditions Way more detail about functions AND conditionals
 h p://arcturo.github.io/library/coffeescript/02_syntax.html BlueBox.on Events.DragEnd, ()->! if BlueBox.x > 100! BlueBox.animate! position: { x: 300 }! else if BlueBox.x < -100! BlueBox.animate ! position: { x: -300 }! else! BlueBox.animate! position: { x: 0 }

Slide 56

Slide 56 text

DYNAMISM Dynamic interfaces respond on-the-fly to user input or interaction Set layer properties based on the changing value of another property ✋ # As BlueBox is dragged, rotate and scale it! BlueBox.on Events.DragMove, ()->! # Moderate how the x value maps to a scale value! BlueBox.scale = BlueBox.x / 300! # Moderate the value differently for rotation! BlueBox.rotation = BlueBox.x / 10

Slide 57

Slide 57 text

EXERCISE 4: RESPONSIVE UI Write a function called resetPosition that animates the PhotoCard layer back to its original position. Call this function on the PhotoCard’s Events.DragEnd event. On Events.DragMove, fade the ThumbsUp or ThumbsDown layer depending on the direction and distance you’ve dragged on the x axis. The opacity value of the thumb should increase as you drag further away from the original position. Make sure you reset the opacity of both thumbs to 0 on Events.DragEnd. Iterate on this drag interaction by also rotating the PhotoCard depending on which direction you drag it on the x axis. Extra credit
 If you drag the PhotoCard layer more than 250px either way on the x axis, animate the card out of view.

Slide 58

Slide 58 text

LESSON 5 PROTOTYPING AN APP Also includes Scrolling Layers

Slide 59

Slide 59 text

SCROLLING You can scroll a layer’s contents in both directions or just one Enable scrolling, make sure the layer has an explicit width/height, and set the clip property to true for that layer # Enable vertical scrolling for! # everything in the Container! Container.height = 1136! Container.clip = Container.scrollVertical = true! # Or just enable scrolling in both planes! Container.scroll = true Container TallLayer TallLayer Container

Slide 60

Slide 60 text

EXERCISE 5: SNAPCAT Set up the feed to scroll up and down. Hint: all of the cards in the feed are subLayers of the Container layer. Create an animated slide-out side navigation that shows when you tap the NavBu on layer and hides when you tap the Menu layer containing nav items. When you tap the PhotoBu on layer, reveal the Camera layer and contents. To hide it, tap the CameraCloseBu on layer. Extra credit
 Enhance the slide-out side navigation by animating the MenuItems layer.

Slide 61

Slide 61 text

APPENDIX

Slide 62

Slide 62 text

FRAMER RESOURCES The official Framer site, including examples and documentation
 framerjs.com Koen Bok, the creator of Framer and Cactus
 koenbok.com The Framer JS Facebook group
 facebook.com/groups/framerjs Framer on Hackdesign.org by Cemre Gungor
 hackdesign.org/lessons/41 Framer on Github
 github.com/koenbok/Framer

Slide 63

Slide 63 text

FRAMER ADD-ONS Shortcuts for Framer by Cemre Gungor
 github.com/facebook/shortcuts-for-framer Sublime Text autocompletion for Framer.js by Andreas Wahlstrom
 github.com/awt2542/SublimeCompletionFramerjs Fluid Framer Layer extensions by some guy named Jay Stakelon
 github.com/stakes/fluid-framer

Slide 64

Slide 64 text

COFFEESCRIPT RESOURCES CoffeeScript documentation
 coffeescript.org The Li le Book on CoffeeScript by Alex MacCaw
 arcturo.github.io/library/coffeescript The CoffeeScript Cookbook
 coffeescriptcookbook.com

Slide 65

Slide 65 text

THX