Link to Original Post/Question > After Effects expressions to sum numbers and control charts.
The answer featured in the original post was nearly the solution I needed for my specific problem. My question is this: Is there a way that I could get, say, four numbers that change randomly and constantly, yet equal 100 at all times?
For example, I was wanting bars in a bar graph to animate along with polling numbers that are still in flux. Let me know if I need to explain more.
I have followed the example in the previous post and have written the following expressions for ease of use:
Layer 1 [Text]
Source Text Parameter
val1 = Math.round(thisLayer.effect("Slider Control")("Slider"));
val2 = Math.round(thisLayer.effect("Slider Control 2")("Slider"));
t = val1 + val2;
val1 + " + " + val2 + " = " + t
Layer 2 [Bar 1]
Scale Parameter
val1 = Math.round(thisComp.layer("Text").effect("Slider Control")("Slider"));
val2 = Math.round(thisComp.layer("Text").effect("Slider Control 2")("Slider"));
t = val1 + val2;
[ val1*100/t, 100 ]
Layer 3 [Bar 2]
Scale Parameter
val1 = Math.round(thisComp.layer("Text").effect("Slider Control")("Slider"));
val2 = Math.round(thisComp.layer("Text").effect("Slider Control 2")("Slider"));
t = val1 + val2;
[ val2*100/t, 100 ]