FORUMS: list search recent posts

Flicker opacity expression issue

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bryan Woods
Flicker opacity expression issue
on Mar 25, 2013 at 4:58:08 pm

I have an expression to flicker a layer's opacity triggered by a marker, written with the help of Dan, and I noticed that it has different results depending on the version of AE. In CS5, this expression works as intended. When it hits a marker, it flickers for 10 frames then stops

In CS5.5, it does one really quick flicker, then it doesn't do anything for almost 4.5 seconds, then starts freaking out (see attached screenshot). Any know if something used in this expression has been subtly changed from CS5 to 5.5?



//Flickers the parameter applied to it for x# of frames triggered by a layer marker

duration = 10; //# of frames
n = 0;

if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time){
n--;
}
}

if (n == 0){
value;
} else {
if (timeToFrames(time) &lt; (timeToFrames(marker.key(n).time)+duration)){
freq = 50; // 10 = 1 cycle per second
60*(1 - Math.cos(freq*time*Math.PI*2))
}else{
value;
}
}


Return to posts index


Dan Ebberts
Re: Flicker opacity expression issue
on Mar 25, 2013 at 7:14:04 pm

Ah yes, I think I remember this one. As I recall, in CS5.5, for some reason, timeToFrames() gets cast as a string. It think you just need to change one line. There are probably several ways to do it, but this should work:

if (timeToFrames(time) < (Number(timeToFrames(marker.key(n).time))+duration)){


The good news is that it appears to be fixed in CS6.


Dan



Return to posts index

Bryan Woods
Re: Flicker opacity expression issue
on Mar 25, 2013 at 8:08:49 pm

Ah, thought so. Your solution seems to work for both CS5.5 and CS6, so thank you.

I've never seen Number() used before though. What is that doing that fixes this for CS5.5? Is it just presenting the result within it as a number instead of as a string?

Thanks again for you help!


Return to posts index



Dan Ebberts
Re: Flicker opacity expression issue
on Mar 25, 2013 at 8:38:16 pm

> Is it just presenting the result within it as a number instead of as a string?

Yes. Without that it concatinates the duration to the end of the "string" from timeToFrames() and you end up with a number that's much larger than it should be.


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]