GithubHelp home page GithubHelp logo

facebookarchive / shortcuts-for-framer Goto Github PK

View Code? Open in Web Editor NEW
411.0 34.0 40.0 510 KB

A collection of useful functions to make mobile prototyping with Framer easier.

License: Other

HTML 0.63% CoffeeScript 5.50% JavaScript 92.85% CSS 1.03%

shortcuts-for-framer's Introduction

Shortcuts for Framer 3

A collection of useful functions to make mobile prototyping with Framer easier. For full reference, check our annotated source code in shortcuts.coffee.

How to use with Framer Studio

  • Create a new Framer project
  • Download shortcuts.coffee and put it in the modules folder of the project
  • At the top of your code, write shortcuts = require "shortcuts"

General

  • After importing your PSD/Sketch layers, call initialize to create global Javascript variables for every layer for quick access:
myLayers = Framer.Importer.load "..."
shortcuts.initialize(myLayers)
  • This will let you access PSD["My Layer"] as simply My_Layer
  • Note that some Javascript variable names are reserved and using them as layer names can cause problems.
  • layer.originalFrame stores the initial position and size of each exported layer, so you can easily revert back to them later

Animation

  • layer.animateTo({x: 100}, [time], [curve], [callback]) is a shorthand that mirrors jQuery's animation syntax. You can specify a duration, curve and callback in order, and omit the ones you'd like. Note that in Framer 3, time is now specified in seconds.
  • layer.slideFromLeft() layer.slideToLeft() (and similarly Right, Bottom, Top) are quick animation functions to animate full screen layers in and out of the viewport. Very useful for prototyping mobile flows.
  • layer.show() layer.hide() shows and hides layers.
  • layer.fadeIn() layer.fadeOut() fades in/out layers with an animation. You can use a custom duration too: layer.fadeIn(0.5)
  • show, hide, fadeIn and fadeOut can take layers or arrays containing layers.

Events

  • Free hover and tap/click states: append touchable to a group's name, and include children that have hover and down in their name. Events will be automatically bound to show these hover and tap/click states.
  • Shortcut: instead of layer.on('touchup', function() {}) use layer.tap(function() {}). This also works with mouse events.
  • Shortcut: instead of layer.on('mouseover', function() {}); layer.on('mouseout', function() {}); use layer.hover(function() {}, function() {})

Display in Device

  • Has been removed since this functionality got added Framer core

Others

  • layer.getChild('name') and layer.getChildren('name') retrieve the children of a layer by name. Useful when traversing the layer hierarchy.
  • Framer.utils.convertRange is deprecated in favor of the native Utils.modulate. Check Framer docs on how to use modulate.

Customization

All the animation functions use curves and times that can be customized. Check the very top of shortcuts.js to see all the options.

Questions

Feel free to contact the project's maintainer, Cemre Gungor, on gem-at-fb-dot-com or @gem_ray on Twitter.

shortcuts-for-framer's People

Contributors

alexismorinef avatar cemre avatar flarnie avatar jamesgpearce avatar joelmarcey avatar paulmand3l avatar sophiebits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.