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

Help Combining two Expressions

New Here ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

Hello,

I have two expressions that both work independently that I am trying to combine to use on the same layer.

The first one is a Z space zoom effect:

zoom = 5000; //distance to zoom

trans = 4; // transition time in frames

trans = trans * thisComp.frameDuration;

inTrans = easeIn(time, inPoint, inPoint + trans, [0,0,zoom], [0,0,0]);

outTrans = easeOut(time, outPoint, outPoint - trans*2, [0,0,0], [0,0,zoom]);

value+ inTrans - outTrans

And the second is an overshoot expression:

freq = 3;

decay = 5;

amp = 80;

n = 0;

if (numKeys > 0){

  n = nearestKey(time).index;

  if (key(n).time > time) n--;

}

if (n > 0){

  t = time - key(n).time;

  amp = velocityAtTime(key(n).time - .001);

  w = freq*Math.PI*2;

  value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);

}else

  value

This is my current attempt at combining the two, but I cant get it working. Thanks in advance for the help!

zoom = 5000; //distance to zoom

trans = 4; // transition time in frames

trans = trans * thisComp.frameDuration;

freq = 3; decay = 1;

inTrans  = easeIn(time, inPoint, inPoint + trans, [0,0,zoom], [0,0,100]);

outTrans = eaoint, outPoint - trans*1, [0,0,0], [0,0,zoom]);

n = nearestKey(time).index;

amp = velocityAtTime(key(n).time - .001);

t = time - inPoint;

w = freq*Math.PI*2;

value + inTrans - outTrans + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);

TOPICS
Expressions

Views

675

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
LEGEND ,
Nov 04, 2017 Nov 04, 2017

Copy link to clipboard

Copied

I'm not clear what you are hoping to achieve. You totally nixed the conditional statemnets to retrieve the keyframe info, so this cannot work - the evaluation condition simply is never valid. That being said, the "trans" stuff would have to be applied as a filter curve to the result of the overshoot expression, not added or subtracted. In effect this simply means where "time" is used in the zoom expression's easIn() and easeOut() you fill in the result of your overshoot. It's a simple case of modulating one result with another. Of course it may require some tweaking, but it's to ealry in the morning for me to realyl get into it...

Mylenium

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 ,
Nov 06, 2017 Nov 06, 2017

Copy link to clipboard

Copied

LATEST

This might work:

zoom = 5000; //distance to zoom

trans = 4; // transition time in frames

trans = trans * thisComp.frameDuration;

if (time < inPoint+trans){

  value + easeIn(time, inPoint, inPoint + trans, [0,0,zoom], [0,0,0]);

}else if (time > outPoint - trans*2){

  value - easeOut(time, outPoint, outPoint - trans*2, [0,0,0], [0,0,zoom]);

}else{

  freq = 3;

  decay = 5;

  amp = 80;

  n = 0;

  if (numKeys > 0){

    n = nearestKey(time).index;

    if (key(n).time > time) n--;

  }

  if (n > 0){

    t = time - key(n).time;

    amp = velocityAtTime(key(n).time - .001);

    w = freq*Math.PI*2;

    value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);

  }else{

    value;

  }

}

Dan

[EDIT]  This is probably better:

freq = 3; 

decay = 5; 

amp = 80; 

n = 0; 

if (numKeys > 0){ 

  n = nearestKey(time).index; 

  if (key(n).time > time) n--; 

}

val = value;

if (n > 0){ 

  t = time - key(n).time; 

  amp = velocityAtTime(key(n).time - .001); 

  w = freq*Math.PI*2; 

  val += amp*(Math.sin(t*w)/Math.exp(decay*t)/w); 

}

zoom = 5000; //distance to zoom 

trans = 4; // transition time in frames 

trans = trans * thisComp.frameDuration;

if (time < inPoint+trans){

  val += easeIn(time, inPoint, inPoint + trans, [0,0,zoom], [0,0,0]);

}else if (time > outPoint - trans*2){

  val -= easeOut(time, outPoint, outPoint - trans*2, [0,0,0], [0,0,zoom]);

}

val

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