0.0.1 • Published 10 years ago

distribute-layers v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Distribute Layers for Framer

Installation Code Examples Full documentation


This package helps you position multiple Framer layers with ease.

You can position layers in three ways:

sameDistancesameMargin spaced
The layers are positioned every nth pixel, regardless of their height. The layers follow each other with a constant margin between them. The layers fill upp the space. The spacing between them is equal.

You ➡️ can ➡️ also ➡️ distribute ➡️ layers ➡️ horizontally.

Installation

  • Download distributeLayers.coffee.
  • Open your project folder (YourProject.framer). Inside it, there is a modules folder. Put distributeLayers.coffee inside it.
  • At the top of your main Framer file, require the package using { distributeLayers } = require "distributeLayers"

Code examples

{ distributeLayers } = require "distributeLayers"

layers = []
layers[0] = new Layer
layers[1] = new Layer
layers[2] = new Layer

distributeLayers.sameDistance
	layers: layers
	distance: 250

Full documentation

There are three functions:

  • distributeLayers.sameDistance(options)
  • distributeLayers.sameMargin(options)
  • distributeLayers.spaced(options)

All functions accept one argument: an options object. The functions can be called with the following arguments:

NameTypeRequiredDescription
layersarrayyesAn array containing the layers you want to distribute.
directionstringnohorizontal or vertical. Defaults to vertical.
startOffsetintnoX/Y starting point for the first layer. X when direction is horizontal, Y when vertical.

➡️ distributeLayers.sameDistance()

In addition to the parameters above, distributeLayers.sameDistance() accepts these additional arguments:

NameTypeRequiredDescription
distanceintnoHow much space to add between each arguments. Defaults to 500.

See example project (Click “open” to view code in Framer Studio)

➡️ distributeLayers.sameMargin()

In addition to the parameters above, distributeLayers.sameMargin() accepts these additional parameters:

NameTypeRequiredDescription
marginintnoMargin between each arguments. Defaults to 10.

See example project (Click “open” to view code in Framer Studio)

➡️ distributeLayers.spaced()

In addition to the parameters above, distributeLayers.spaced() accepts these additional parameters:

NameTypeRequiredDescription
maxintnoThe max area within which the layers should be rendered. Defaults to 1000.

See example project (Click “open” to view code in Framer Studio)