GithubHelp home page GithubHelp logo

bryant1410 / find-for-framer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awt2542/find-for-framer

0.0 2.0 0.0 2.37 MB

Target layers in Framer.js using CSS-like selectors

Home Page: https://twitter.com/andreaswah

HTML 8.81% CoffeeScript 10.99% JavaScript 78.04% CSS 2.17%

find-for-framer's Introduction

Find for Framer

Inspired by CSS selectors, this module makes it easier to find and target layers based on the .name property.

Basic examples

# the florin sign (option+f)
ƒ('card1') # returns the first layer matching the name "card1".
ƒƒ('card') # returns an array with all layers named "card" (case-sensitive)
ƒƒ('card > image') # all layers named "image" and direct descendants of layers named "card"
ƒƒ('card image') # all layers named "image" and descendants of layers named "card"
ƒƒ('card, image') # all layers named "card" and all layers named "image"
ƒƒ('card*') # all layers with names starting with "card". eg. card1,card2,card3 etc.
page.currentPage.ƒƒ('card') #  all layers named "card" and descendants of the current page

findModule

Try the example project: http://share.framerjs.com/fcwnnqn7npi7/

Tutorial: https://blog.prototypr.io/prototype-user-flows-in-framer-studio-dc87f5211a47#.el1t0sv8k

Installation

  1. Download findModule.coffee to your project's /modules directory
  2. Add {ƒ,ƒƒ} = require 'findModule' to the top of your code
  3. Make sure you're running the latest version of Framer.js. File -> Update Framer...

More info: Framer Docs - Modules

Reference

ƒƒ(selector) # returns array of layers matching the selector
ƒ(selector) # same as above, but returns first matching layer

layer.ƒƒ(selector) # only search descendants of layer
layer.ƒ(selector) # same as above, but returns first matching layer
Selector Result
A Any layer named A
A B Any layer named B that is a descendant of a layer named A (that is: a child, or a child of a child, etc.)
A > B Any layer named B that is a child (i.e. direct child) of a layer named A
A, B Any layer named A or any layer named B
* Any layer (wildcard character)

More examples

ƒƒ() # find all layers in your project
ƒƒ('card > *') # find all layers that are direct descendants of layers named "card"
ƒƒ('card *') # find all layers that are descendants of layers named "card"
ƒƒ('*image*') # find all layers containing "image"
ƒƒ('*card*,*image*') # find all layers containing either "card" or "image"
ƒƒ('card1 > container *') # find all descendant layers of the "container" inside "card1"

# Add a "slide in" animation to all layers ending with "_slideIn"
for layer in ƒƒ('*_slideIn')
    originalValue = layer.maxX
    layer.maxX = 0
    layer.animate
        properties:
            maxX: originalValue
            
# Find layers not stored in variables
for i in [0..5]
    new Layer
        name: item+i
        y: 100*i
        
ƒ('item2').x = 200

Contact

Twitter: @andreaswah

Thanks to

Jordan, Marc, David and Koen for early feedback!

find-for-framer's People

Contributors

awt2542 avatar joshuacrowley avatar bryant1410 avatar

Watchers

 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.