FORUMS: list search recent posts

Keep opacity constant

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alexander Schlosser
Keep opacity constant
on Oct 24, 2014 at 1:08:10 pm
Last Edited By Alexander Schlosser on Oct 24, 2014 at 1:42:50 pm

Hello everybody,

I’m new to the world of expressions and have a problem that sounds pretty easy to me (but it actually drives me crazy).
I’ve tried to find an answer all over the internet but couldn’t find it (or I might’ve just searched for the wrong keywords).

What I’m trying to do:

I have 30 hidden layers (0% opacity) that should get visible in a random order.
Therefore, I set up a counter that runs through an array of different numbers.

I added the following expression to the opacity attribute of every layer:

n = 6;
slider = thisComp.layer("control").effect("Einstellungen für Schieberegler")("Schieberegler");
if (slider == (n - index)) 100 else 0;


And it actually works pretty well and changes the opacity to 100% at the right time.
The problem is just that it jumps back to 0 in the next frame. However, I want it to keep 100 as a value for the rest of the time.
Is there an easy solution to do so?


Return to posts index

Dan Ebberts
Re: Keep opacity constant
on Oct 24, 2014 at 4:26:06 pm

Is it an expression that drives the slider values? If so, what does that look like?

Dan



Return to posts index

Alexander Schlosser
Re: Keep opacity constant
on Oct 28, 2014 at 8:47:58 am

I actually used one of your (extremly helpful) code examples and changed it just a little bit.
Here it is:

function shuffle(o){
seedRandom(7, timeless = true);
for(var j, x, i = o.length; i; j = parseInt(random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
}

layerArray = [];
for (i = 0; i <=5; i++) {
layerArray.push(i);
}

layerArray = shuffle(layerArray);


threshold = 10.0;

audioLev = thisComp.layer("Führungsebene").effect("Beide Kanäle")("Schieberegler");

above = false;
frame = Math.round(time / thisComp.frameDuration);
n = 0;
while (frame >= 0){
t = frame * thisComp.frameDuration;
if (above){
if (audioLev.valueAtTime(t) < threshold){
above = false;
}

}else if (audioLev.valueAtTime(t) >= threshold){
above = true;
if (n < 5) n++;
}
frame--
}

layerArray[n]


Return to posts index

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