This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
JL Flores Mena
Posted Oct 15 - Read on Facebook

Hey Frameristos, I've been struggling for quite some time with this challenge and decided to ask for help:

Have you noticed that when you scale an object, its frame values remain the same?

Try this:
layerA = new Layer
layerA.scale = 0.5
print layerA.frame

The output is:
{x:0, y:0, width:100, height:100}

So my question is, is there a way to get x & y values of the scaled object?

Note: Scale acts based on the originX and originY values on an object, usually 0.5. But this gets really tricky when you're scaling an object from different points, not just the center. This is the part I'm struggling with, getting one algorithm that solves for all cases.

Thanks!

7 Comments

Jordan Robert Dobson

So you could first use the scale value to get the width and height. Then get the origin X and Y (0-1 values) to manipulate the X and y

Jordan Robert Dobson

I believe Joshua Tucker has a module / code about this on http://FramerCo.de

JL Flores Mena

Yes, that's exactly what I've been trying to do. I have this formula that works great... if the originX & Y are 0.5... So I'm still trying to find the solution for all cases. Thanks for sharing, I'll look that code.

JL Flores Mena

This may be it! Amazing. And actually, I'm trying to solve a bigger issue, this is one part of the puzzle that has cost me a lot of hours. I'll share the solution if I crack the whole riddle. Thanks!

JL Flores Mena

I found a solution!! Make sure to download the file so you can change the scale and other values: http://share.framerjs.com/221zbqlpmpqc/
I gotta say, Joshua's module is great, but it had the same issue I was having: if the object had different originX&Y values, the math lost track of the 0,0 coordinate of the scaled object. Hey Joshua, your module is the best, please let me know if I can help to integrate this part of the puzzle we were talking about earlier.

Elvis Nuñez

Frameristos

Read the entire post on Facebook