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

Multiple Expressions

Guest
Feb 09, 2011 Feb 09, 2011

Is there any way that I can patch the same expression in the same property layer multiple times? What if I would like my camera to execute the same expression at different points in the composition?

TOPICS
Expressions
2.8K
Translate
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 , Feb 09, 2011 Feb 09, 2011

Something like this should work:

freq = 1;
amp = 25;
n = 0;
if (thisProperty.numKeys > 0){
  n = thisProperty.nearestKey(time).index;
  if (thisProperty.key(n).time > time) n--;
}
if (n > 0 && n < thisProperty.numKeys && n%2 == 0){
  t1 = thisProperty.key(n).time;
  t2 = thisProperty.key(n+1).time;
  if (time > (t1 + t2)/2)
    easeOut(time,t1,t2,wiggle(freq,amp),value)
  else
    easeIn(time,t1,t2,value,wiggle(freq,amp));
}else
  value

Dan

Translate
Community Expert ,
Feb 09, 2011 Feb 09, 2011

It's possible to set an expression up so that it is triggered by markers or runs at specific times, but the specifics depend on what it is you're trying to do.

Dan

Translate
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
Guest
Feb 09, 2011 Feb 09, 2011

Can they also be triggered by keyframes?

Translate
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 ,
Feb 09, 2011 Feb 09, 2011

Yes. The way you would do it depends on what you're trying to accomplish though.

Dan

Translate
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
Guest
Feb 09, 2011 Feb 09, 2011

Ok, let try to explain.

In the picture below, I have about 10 keyframes in the position property of the Camera Master layer. I'm trying to assign a wiggle expression in between the  keyframes that are separated furthest from each other. For example, if I  we're to go by numeric order, I would put the wiggle expression in  between keyframes 2 and 3, 4 and 5, 6 and 7, 8 and 9, etc.

Does that make sense?

Example.jpg

Translate
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 ,
Feb 09, 2011 Feb 09, 2011

Something like this should work:

freq = 1;
amp = 25;
n = 0;
if (thisProperty.numKeys > 0){
  n = thisProperty.nearestKey(time).index;
  if (thisProperty.key(n).time > time) n--;
}
if (n > 0 && n < thisProperty.numKeys && n%2 == 0){
  t1 = thisProperty.key(n).time;
  t2 = thisProperty.key(n+1).time;
  if (time > (t1 + t2)/2)
    easeOut(time,t1,t2,wiggle(freq,amp),value)
  else
    easeIn(time,t1,t2,value,wiggle(freq,amp));
}else
  value

Dan

Translate
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
Guest
Feb 09, 2011 Feb 09, 2011

Whoa! That did do the trick, yes! Thank you so much! From the way it looks, I gotta long way to go before I master expressions...

Translate
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
Guest
Feb 09, 2011 Feb 09, 2011

Would there be any way to omit keyframes in that same layer from this expression? Or does the expression itself occupy the entire layer unconditionally?

Translate
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 ,
Feb 09, 2011 Feb 09, 2011
LATEST

The expressin always controls the value, but just like between odd and even keyframes, you can define regions where the expression's result is "value" which tells the expression to just use the property's pre-expression (keyframed) value. It's hard to give a general answer though, because the solution always depends on exactly what it is you're trying to do.

Dan

Translate
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