Giter Club home page Giter Club logo

flexer's Introduction

Flexer

Flexer is a FramerJS module that allows you to create flexible layouts. This means you can use proportions or relative values instead of absolute pixels to position and animate layers on your prototypes.

NOTE: Flexer is in a very early stage of development, so unexpected behavior is... expected. It's a work in progress. All bug reports, feature requests, and general feedback are greatly appreciated! ๐Ÿ‘Š

Demo

3-Step Installation

In order to install it, you will need node/npm.

  1. From your Framer project folder, type npm install flexer. Hint: You can add the --save flag if you want the package to appear in your project dependencies.
  2. Create a file npm.coffee in your modules folder, with this line: exports.flexer = require "flexer"
  3. Lastly, add the following line in app.coffee (or your main file): { flexer } = require "npm"

For further information about modules, check the awesomic Framer documentation.

How does it work?

Once you import the module on your main file, Flexer will add the properties listed below to the Layer class. Flexer tries to not be intrusive and doesn't modify your layers until you use one of these properties.

This means you can have in the same project some layers with the default Framer layout (using x, y, width, height) and other layers with a flexible layout.

NOTE: Once a layer becomes flexible, you should use left, right, top, bottom and fixedWidth, fixedHeight instead of x, y, width, height. If you want to position elements absolutely and not relatively to their parents and siblings, use position: absolute.

Properties added to Layer

From css-layout readme:

  • fixedWidth, fixedHeight: positive number (animatable)
  • minWidth, minHeight: positive number (animatable)
  • maxWidth, maxHeight: positive number (animatable)
  • left, right, top, bottom: number (animatable)
  • margin, marginLeft, marginRight, marginTop, marginBottom: number (animatable)
  • padding, paddingLeft, paddingRight, paddingTop, paddingBottom: positive number (animatable)
  • borderLeftWidth, borderRightWidth, borderTopWidth, borderBottomWidth: positive number (animatable)
  • flexDirection: 'column', 'row'
  • justifyContent: 'flex-start', 'center', 'flex-end', 'space-between', 'space-around'
  • alignItems, alignSelf: 'flex-start', 'center', 'flex-end', 'stretch'
  • flex: positive number (animatable)
  • flexWrap: 'wrap', 'nowrap'
  • position: 'relative', 'absolute'

NOTE: borderWidth is not available for now, until I find a way to solve the conflict with the existing Layer property.

One more thing...

If you want to animate the layout transitions, you can use the layout.curve property of the layer. For example:

	# Now all layout modifications on layerA and sublayers 
	# will be animated
	layerA.layout.curve = "spring(300, 40, 10)"

Resources

Thanks to

flexer's People

Contributors

jchavarri avatar

Watchers

James Cloos avatar Denis Drozhzhov 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.