Skip to main content

Use expressions to set object properties (e.g. size)

  • August 22, 2023
  • 1 reply
  • 357 views

Daniel_Amann

I want to use an expression to set the width of an object so it matches the width of another object. I imagine it to work like this: In the width property: = width of [layer]

The concrete use case looks as such:
For a library component in its loading state, the text is replaced with a skeleton (an animated gradient). Auto-layout doesn’t allow me to keep the width of the default state - that is determined by the text layer (hug) – when switching to the loading variant.

1 reply

Daniel_Amann

I hacked a solution with setting the layer opacity to 0% on the text layer and setting layer constraints to scale on the skeleton. I’d still like to set the size relationship “programatically”.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings