After Effects Expressions

Currently Being Moderated

Feb 10, 2012 2:23 AM

Another newbie question.

Tried this expression on a layers opacity:

d = Math.abs(time -transform.position.nearestKey(time).time);

easeOut(d, 100, 0)

The idea was to make the layers opacity go from 100% to 0 on every keyframe.

What actually happens is the opacity goes down to 36% in the middle between two keyframes, then goes up to 100 again.

Replies
• Currently Being Moderated
Feb 10, 2012 10:19 AM   in reply to Lars Renklint

If you want it to fade out at each keyframe, doesn't that mean it will always be at 0% after the first keyframe?

Dan

|
Mark as:
• Currently Being Moderated
Feb 10, 2012 10:43 AM   in reply to Lars Renklint

Try this:

n = 0;

p  = transform.position;

if (p.numKeys > 0){

n = p.nearestKey(time).index;

if (p.key(n).time <= time) n++;

}

if (n > p.numKeys) n = 0;

if (n > 0){

t = p.key(n).time;

}else

100

Dan

|
Mark as:
• Currently Being Moderated
Feb 10, 2012 5:50 PM   in reply to Lars Renklint

Hmmm... it's hard to figure out what's going on. Can you post a screenshot of your keyframes?

Dan

|
Mark as:
Actions

More Like This

• Retrieving data ...