• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

An expression that adds up

New Here ,
Jan 26, 2024 Jan 26, 2024

Copy link to clipboard

Copied

Hello,

I'm trying to find out if there's an expression that adds up every X images?

The problem:
A machine that 2 times per second will increase its value by 88kg.
In other words, a calculation that would add the imposed figure of 23604 by 88 every 12 images.

As I couldn't find this calculation, I did it by hand ^^, but I'd still like to find a less restrictive solution.

Thanks

TOPICS
Expressions

Views

84

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2024 Jan 26, 2024

Copy link to clipboard

Copied

If you start by subtracting the layer's inPoint from the time, then divide that number by the interval and use Math.floor() to keep the value a whole number, you will get an even number multiplier you can use to add that value to a starting number. The expression is fairly simple. Add it to a text layer/Text property and you have your counter.

t = time - inPoint;
count = t / .5; // interval time in seconda
num = Math.floor(count);
step = 88 * num; // value increase
strt = 23604 + step; // starting Number
result = strt + "kg"

To keep the numbers from bouncing around, you will need to use a monospaced font like Courier;

RickGerard_0-1706276507459.gif

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2024 Jan 26, 2024

Copy link to clipboard

Copied

LATEST

Thank you very much! It works perfectly 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines