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

Changing speed of a Quicktime layer based on speed of another layer

New Here ,
Oct 11, 2009 Oct 11, 2009

Copy link to clipboard

Copied

Hi everyone- I'm new to expressions.

I'm trying to alter the speed of a layer of a quicktime movie. The speed at which it plays should reflect the velocity of another object. The faster that object moves, the faster the quicktime movie plays and vice versa.

For some reason, adding an expression to time remapping does to work for velocity.

Any help would be appreciated

TOPICS
Expressions

Views

1.7K

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

correct answers 1 Correct answer

Community Expert , Oct 12, 2009 Oct 12, 2009

Try setting the variable "factor" to a smaller number.

Dan

Votes

Translate

Translate
Community Expert ,
Oct 12, 2009 Oct 12, 2009

Copy link to clipboard

Copied

Using an expression to control the speed of something based on the speed of something else is always a bit of tricky business. What you really need in this case, I think, is to link the elapsed time-remapped time of the QT movie to the total distance traveled by your other layer. That requires a frame-by-frame integration operation. Since it has to look at each previous frame, it can bog down as the length of your piece increases. Here's how it would look though:

L = thisComp.layer("Layer 1"); // your speed layer
factor = 25; // increase this to increase overall speed

f = timeToFrames();
fCount = 0;
accum = 0;
while (fCount < f){
  accum += L.transform.position.speedAtTime(framesToTime(fCount))*thisComp.frameDuration;
  fCount++;
}
accum*(factor/1000)

Dan

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 ,
Oct 12, 2009 Oct 12, 2009

Copy link to clipboard

Copied

Oh my gosh Dan, you're awesome! Have been using AE for years and never used these forums before because I haven't run across something I couldn't do, but now that I'm using expressions more, I realize I haven't fully tapped into the potential of AE. This forum looks to be a great solution. I hope to post answers to others' questions later on when I get more experienced.

I'm not sure I'm putting your expression in the right spot and/or defining the layers correctly though.

What I'm trying to do exactly is the following: I have 2 layers:

     Red Solid: a solid I've moved around the screen in which visibility ultimately is turned off with "auto-orient" turned on

     Man walking mov: a quicktime movie of a looping man walking that is "parented" to the red solid.

The goal is to get the speed of the looping man's gait to match the speed at which it "walks."

So, my questions are:

1. Where exactly do I place your expression? Do I place the expression in the Time Remap created for the Man Walking layer?

2. If I were to redefine the layers according to your expression, do I correct the following in bold?

L = thisComp.layer("Red Solid"); // your speed layer
factor = 25; // increase this to increase overall speed

f = timeToFrames();
fCount = 0;
accum = 0;
while (fCount < f){
   accum += L.transform.position.speedAtTime(framesToTime(fCount))*thisComp.frameDuration;
   fCount++;
}
accum*(factor/1000)

3. Finally, if I want to tweak the speed at which the frames move to ensure accurate walking speed relative to the speed of the red solid, what do I adjust on the expression?

I've already done what I've asked above and it seems that the man walking speed increases gradually throughout the duration of the comp, but is not adjusting to the speed of the red layer.

Any suggestions would greatly help me out!!!

Thanks in advance!

Richard

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 ,
Oct 12, 2009 Oct 12, 2009

Copy link to clipboard

Copied

Actually, I think it works!!!!

I've been checking out different speeds of the red solid, and the man's walking speed adjusts accordingly. However, his walking speed is too fast relative to the actual speed of his movement. So, my only question is in regards to the tweaking of the speed (question 3).

Thanks again!

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
Community Expert ,
Oct 12, 2009 Oct 12, 2009

Copy link to clipboard

Copied

Try setting the variable "factor" to a smaller number.

Dan

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 ,
Oct 12, 2009 Oct 12, 2009

Copy link to clipboard

Copied

LATEST

Thanks so much Dan. You saved me a ton of time!

Rich

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