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

Using Expressions to Change a Precomp's Framerate / Time-Remapping?

Explorer ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

Hi Everybody,

 

I have a situation where I have a side-scrolling 'game' where the road/foreground, street elements, and background need to travel sideways on an X-axis but at different speeds.

 

Now, there's the hand-made way of creating separate (super long) length of background and then set a keyframe at the beginning and end. But it would be a LOT nicer if I could set three separate precomps in a loopOut() and then change their frame rate by a slider (or something).

 

Is that possible? and if so, are there any tutorials on this subject? Making Precomps more..."object-oriented" (for lack of better wording) would be great for templating and beyond. 

 

Thanks for reading. 🙂

TOPICS
Expressions , How to

Views

142

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 ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

LATEST

You could use a "roll your own" loopOut("cycle") expression like this, that would use a Slider Control to set (not animate though) the speed (in percent). So setting the slider to 200 would make it twice as fast, etc.:

spd = effect("Speed")("Slider");
t0 = time*spd/100;
if (numKeys > 1 && t0 > key(numKeys).time){
  t1 = key(1).time;
  t2 = key(numKeys).time;
  span = t2 - t1;
  delta = (t0 - t2);
  t = delta%span;
  valueAtTime(t1 + t);
}else
  valueAtTime(t0)

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