Activity › Forums › Adobe After Effects Expressions › Change opacity every n-frames
-
Change opacity every n-frames
Posted by Luis Garcia on October 24, 2015 at 11:11 amHI! I would need an expression to change the opacity betwen two values (30% and 0%) each n-frames.
I have 15 text layers with wiggle expressions, but 15 layers is too much. I would like some expressions to be able to show 7 text layers (with 30% opacity) for n-frames (imagine 18 frames) and then the other 8 text layers other 18 frames for example, and then appears again the first 7 text layers for 18 frames and every time with this secuence durinig all the clip.
Any idea to do this??
A lot of thanks in advance!!!
Good Weekend!
Dan Ebberts replied 2 years, 7 months ago 3 Members · 12 Replies -
12 Replies
-
Dan Ebberts
October 24, 2015 at 5:50 pmYou could use something like this for the first group:
val1 = 30;
val2 = 0;
n = 18;
f = timeToFrames(time);
s = Math.floor(f/n);
s%2 ? val2 : val1and switch the last line to this for the second group:
s%2 ? val1 : val2
Dan
-
Luis Garcia
October 24, 2015 at 9:44 pmThanks Dan, it works perfectly!!! A lot of thanks Dan.
I have another question… How I can modify this expressions to get, for example, three or four groups of text layers doing this….
For example:
Layer 1 – 18 frames opacity 30, and then 0 for 36 frames
Layer 2 – 18 frames opacity 0, 18 frames opacity 30, and 18 frames opacity 0 again
Layer 3 – 18 frames opacity 0, others 18 frames opacity 0, and then 18 frames opacity 30I mean like three blocks of 18 frames, and each layer appears in one of this blocks…. would it be possible?
A lot of thanks!
-
Dan Ebberts
October 24, 2015 at 10:45 pmThis would be one way. You’d have to edit the first line for each layer:
pattern = [30,0,0];
n = 18;
f = timeToFrames(time);
s = Math.floor(f/n);
pattern[s%pattern.length]Dan
-
Luis Garcia
October 25, 2015 at 10:05 pmGreat again Dan! It seems that works perfectly. I will try it more slowly and feedback. I supousse that if I want to create a 4 group, in the first line I will put this, isn´t it?
pattern = [30,0,0,0]
And then edit for each group….that´s right?
A lot of thanks!!!
-
Luis Garcia
October 26, 2015 at 9:05 amA lot of thanks Dan for your answer and time….
That´s a great solution for “my problem”.
I am wondering one thing now… I have 21 text layers, and I want to divide them into three groups…
I have tried to create three null objets and then linking each 7 text layers to their null object, and then apply the expressions into the null objects but I hadn´t any result…
Can´t I do it? Another way to do? Could I create a group or something like this or apply the expressions to my 7 layers at the same time??
Thanks again Dan!!!
-
Luis Garcia
November 10, 2015 at 11:26 pmHi! One Question Dan… If I precompose I lost my effect of this expression… Could I modify the expression to work with precomposing??
I am thinking to create one precompose for every 7 text layer to organize the project better, but when I have done it… I lost the effect of the expression…
Could you help me? How would be the expression with precompose?
Imagine I have 3 precompose….
Thanks in advance!
-
Luis Garcia
November 11, 2015 at 8:53 amI am precomposing every 7 text layers, if I have 21 text layers, I am doing 3 precomposing with the same expressions… Yesterday, I did another prove and it worked… So I don´t know if perhaps before I will make a mistake….
Is correct to precompose with expressions and they have to work?
Thanks!
-
Dan Ebberts
November 11, 2015 at 2:55 pmIt depends on the expression. If it doesn’t reference other layers it should be fine.
Dan
Reply to this Discussion! Login or Sign Up