/ScaleFrame

Module for Framer Studio to calculate properties of a scaled layer using its new dimensions.

Primary LanguageJavaScript

ScaleFrame

Calculate the properties of a scaled layer using its new dimensions. Since scaling a layer only changes it visually, not physically by its actual property dimensions, this is a great tool!

Usage

Put the scaleFrame.coffee file in the /modules folder inside your Framer project. To include in Framer Studio, put the following code at the top of your project:

variableName = require "scaleFrame"

Calculate Values

Using the line of code below, pass in your scaled layer and specify true or false.

###

TRUE means you want absolute property values (see layer.screenFrame for documentation)
FALSE means you want default property values (relative to superLayer/parent layer if applicable)

###

variableName.scaleFrame(scaledLayer, true)

Properties

Below are the full list of properties that are returned.

variableName.scaleFrame(scaledLayer, true).

  • x
  • y
  • minX
  • minY
  • midX
  • midY
  • maxX
  • maxY
  • width
  • height

Example

Download scaleFrame.framer to see how this module works.