Skip to main content
Participant
March 2, 2025
Question

How to automatically increase keyframe values (1, 2, 3, 4, etc...)

  • March 2, 2025
  • 1 reply
  • 275 views

I have created a counter in a composition. I also have keyframes with interpolation of Hold. I want to copy and paste hundreds of this keyframe and configure it so that each keyframe has a value of +1 of the prior keyframe. I could do this manually, but is there a smarter way to do it?

 

Thanks for help!

1 reply

thepixelsmith
Community Expert
Community Expert
March 2, 2025

This sounds like something that would proably be better done with an Expression.

Is there a reason you want hundreds of keyframes?

Participant
March 2, 2025

Thank you for replying.

 

I will have a composiiton in AE that will count the number of times an action happens. The counter will increase incrementally at different times in the composition, which I will have to place manually in the Timeline. I'm OK with that.

 

But what I want to do is set up the composition with the counter and all the keyframes ready with their individual values. The first keyframe will have a value of 0. The one after that, 1. The final key frame will have a value of 300.

 

I know I can duplicate keyframes by copying and pasting. That's easy enough. But each keyframe has to have its own value. I could go into each one and manually enter those values, but I am curious to know if there is a formulaic way of doing it, so the values are created automatically when I set all this up.

 

Think of Excel. I have a starting cell with a value of 0 and then a formula in the next cell that references the first with the statement [prior cell + 1]. And the cell after that has the same. I can stretch that out three hundred times to get cells with incremental values from 0 to 300.

 

If you have any thoughts on the expression solution, please let me know. In the mean time, I'll Google away.

 

Many thanks.

New User
ShiveringCactus
Community Expert
Community Expert
March 2, 2025

I think you are describing a situation where you only want whole numbers to appear.  Try this expression on your slider:

Math.floor(value)

Math.floor rounds the value down to the nearest integer.  So 1.9 becomes 1, then when the slider reaches 2 or 2.1 etc... it becomes 2.