Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combine values dynamically maintain set value

  • Combine values dynamically maintain set value

    Posted by Eric Sanderson on August 20, 2014 at 7:22 pm

    How would i go about making the scale[0] of 4 different layers always add up to 227.65 (seems arbitrary i know, a lot to explain). when 1 is at 100, the rest are at 44.55, no matter how you scrub the value of any particular one, the rest adjust accordingly.

    The effect would be that of an accordion style selection state, the group of objects left and right edges are fixed, but highlighting one at a time does some expanding/contracting. I come across this often in my work and i know there must be a better way than seemingly endless linear’s and if else statements making all of the scales aware of each other. When it comes down to it if they all add up to a predetermined value that should accomplish what i want.

    As usual, thanks for any and all advice 🙂

    Eric Sanderson replied 11 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 20, 2014 at 8:03 pm

    You might be able to do it if each layer can figure out which layer is selected, how much of the total allotted space that layer is taking up and set the scale so that it is sized to the remainder of the space divided by three. If the layer is the selected one, it just uses the property value. Something like that.

    Dan

  • Eric Sanderson

    August 20, 2014 at 9:03 pm

    figuring out which is selected is where it got messy. Had a slew of if else if’s. Then manually added all of the scale[0]s and manipulated with linear’s. Thats when i decided all each layer really needs to know is the combined scale[0] of the rest of the layers, and what it needs to do accordingly in relation to the predefined “value”. Was hoping there some for while, or any iterator method sequencing through making sure all of the parameters added up to “value”.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy