Variables and caltulations

Hello, i am playing with varaibles, and i wanted to do a certain task that might solve a long running problem and didn’t succed. Then i thought to share it here in case it gets any interest…

The long running problem is that we cannot resize frames/images keeping their aspect ratio. In my case that would make the responsive conversion task much easier.
For now, I use a plugin that stores the initial aspect ratio and applies it back once I resized the frame. Not optimal but functional.

With the launch of variables, I RUSHED to try to do the following.

  • Set an empty variable to store the current width of the object name: currentWidth
  • Set another variable that makes the following calculation: currentWidth/2 and name it targetHeight.

That would make a 2:1 aspect ratio image.

By doing this, we could resize the component and the specified frame would keep its aspect ratio untouched.

I guess this is by no means how variables are supposed to work. or is it?

Hi @Jairo,

I can confirm it is currently not possible to use variables this way indeed. You would need to enter a proper value (number) to make it work - “currentWidth/2” won’t work.

However, if you add an image with “Fill” to a 1000x500 frame and create a variable where this frame dimensions are changed to 500x250, the image will automatically resize and keep filling the frame with the same ratio.

But I can see how what you suggest could be useful and I have I’ve noted it for our Product team. At this point, I can’t guarantee anything on our end, but I’m happy give it some more visibility!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.