<p>This kind of thing might do it?</p>
<p><a href="https://i.sstatic.net/z1o6B.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z1o6B.gif" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/Hd4k6.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Hd4k6.jpg" alt="grab" /></a></p>
<p>Null control at the top has a slider for movement and a slider for scale factor (how much you want each index position to be affected).</p>
<p>The rotation of each &quot;leaf&quot; is controlled by an expression.</p>
<pre><code>thisComp.layer(&quot;Null 1&quot;).effect(&quot;Slider Control&quot;)(&quot;Slider&quot;) * (thisComp.layer(&quot;Null 1&quot;).effect(&quot;scalefactor&quot;)(&quot;Slider&quot;)*(1/index))
</code></pre>
<p>Which takes the value of slider 1, multiplies it by the inverse of the scale factor.</p>
<p>Then a &quot;loop out&quot; property on slider one and three keyframes does the animation (number of keyframes is counted from zero):</p>
<pre><code>loopOut(type = &quot;cycle&quot;, numKeyframes = 2)
</code></pre>

CC BY-SA 4.0
2024-03-07T10:41:20.390Z
2024-03-07T10:41:20.390Z
tomh
<p>I would like to reduce the value looping rotation of the leaves on this foliage design further towards the base of the design. I could do this manually by setting two keyframes and setting the rotation of each leaf from a negative value to a postive value. Then I can add the expression</p>
<blockquote>
<p>loopout (&quot;pingpong&quot;)</p>
</blockquote>
<p>to achieve the motion in a short loop that can be time remapped.</p>
<p>However it is tedious to do this for multiple leaves.</p>
<p>I am aware of the index expression and how it can increase a value like rotation depending on the value of the layers index number in the stack on the timeline. Can the index expression also be used to target individual keyframes.</p>
<p>It would be nice to be able to increase the value of the rotation from -2 to 2 degrees at the base of the plant up to say -16 to 16 degrees right at the tip using an expression like index combined with something else to automate the process of setting up the rotations?</p>
<p>Thank you<a href="https://i.sstatic.net/vmLfK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vmLfK.png" alt="Plant" /></a></p>

<after-effects><after-effects-expressions>
Adding the index expression to a rotation property and making that change over multiple keyframes?
Jonathan Beech
# Adding the index expression to a rotation property and making that change over multiple keyframes?

(Asked by: username_0 on 2024-02-23)

I would like to reduce the value looping rotation of the leaves on this foliage design further towards the base of the design. I could do this manually by setting two keyframes and setting the rotation of each leaf from a negative value to a postive value. Then I can add the expression

> loopout ("pingpong")

to achieve the motion in a short loop that can be time remapped.

However it is tedious to do this for multiple leaves.

I am aware of the index expression and how it can increase a value like rotation depending on the value of the layers index number in the stack on the timeline. Can the index expression also be used to target individual keyframes.

It would be nice to be able to increase the value of the rotation from -2 to 2 degrees at the base of the plant up to say -16 to 16 degrees right at the tip using an expression like index combined with something else to automate the process of setting up the rotations?

Thank you[![Plant](https://i.sstatic.net/vmLfK.png)](https://i.sstatic.net/vmLfK.png)

**Tags:** after-effects, after-effects-expressions


---

## 1 answers

### Answer by username_1 on 2024-03-07. Score: 0

This kind of thing might do it?


Null control at the top has a slider for movement and a slider for scale factor (how much you want each index position to be affected).
The rotation of each "leaf" is controlled by an expression.
thisComp.layer("Null 1").effect("Slider Control")("Slider") * (thisComp.layer("Null 1").effect("scalefactor")("Slider")*(1/index))

Which takes the value of slider 1, multiplies it by the inverse of the scale factor.
Then a "loop out" property on slider one and three keyframes does the animation (number of keyframes is counted from zero):
loopOut(type = "cycle", numKeyframes = 2)


---

