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

Help Combining two expressions

Community Beginner ,
Nov 01, 2016 Nov 01, 2016

Hi everyone.  I have two expressions which im trying to combine to work on the scale property of a shape layer. The first one is a bounce expression and the second is an expression to use a slider to control the scale of a layer (on the second keyframe). It might help to check out the original thread (Controlling the scale of a shape layer using slider control and expressions. ) where I was given the second expression to get an better idea. If anyone can help that would be greatly appreciated.

Bounce expression

amp = .1;

freq = 2.0;

decay = 4.0;

n = 0;

if (numKeys > 0){

n = nearestKey(time).index;

if (key(n).time > time){

n--;

}}

if (n == 0){ t = 0;

}else{

t = time - key(n).time;

}

if (n > 0){

v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{value}

Expression to control scale of the layer

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");

x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);

[x,x]

TOPICS
Expressions
2.7K
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 , Nov 01, 2016 Nov 01, 2016

Like this maybe:

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");

x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);

val = [x,x]

amp = .1;

freq = 2.0;

decay = 4.0;

n = 0;

if (numKeys > 0){

  n = nearestKey(time).index;

  if (key(n).time > time){

    n--;

  }

}

if (n == 0){

  t = 0;

}else{

  t = time - key(n).time;

}

if (n > 0){

  v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

  val + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{value}

Dan

Translate
Community Expert ,
Nov 01, 2016 Nov 01, 2016

With my extension ExpressionTimeline, you can combine any expressions over time. You can even smoothly transition from one expression to another one or transition from expressions to regions where to expression is active.

Expression Timeline 2 - aescripts + aeplugins - aescripts.com

For simple cases you can also combine expressions like this:

if(time < 10){

   // write here the expression that should be active for the time before 10s

}

else {

   // write here the expression that should be active for the time after 10s

}

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
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 Beginner ,
Nov 01, 2016 Nov 01, 2016

Thanks for replaying but this method doesnt work for me. Tha bounce effects still works when I combine it using your method but I am not able to scale using the slider.

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 ,
Nov 01, 2016 Nov 01, 2016

Like this maybe:

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");

x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);

val = [x,x]

amp = .1;

freq = 2.0;

decay = 4.0;

n = 0;

if (numKeys > 0){

  n = nearestKey(time).index;

  if (key(n).time > time){

    n--;

  }

}

if (n == 0){

  t = 0;

}else{

  t = time - key(n).time;

}

if (n > 0){

  v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

  val + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}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
Community Beginner ,
Nov 01, 2016 Nov 01, 2016
LATEST

That work perfectly. Thanks a bunch 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