Discussion:
Opacity expression
(too old to reply)
d***@adobeforums.com
2008-08-04 05:22:30 UTC
Permalink
Hi
It's rather an expression issue so i post it here as well.
I've got a comp (720*576).In this comp 256 layers form a grid (16rows+16columns).
opacity expession so far:

pRow=Math.ceil(index/16);
pCol=Math.ceil(index-(pRow-1)/16);
if(pRow % 2 == 0){
linear(index,1,256,100,0)//even row
}else {
100-index*(100/256) //odd row
}

Basically,on the first row(layer1-16) layers opacity should decrease from left to right.
however,on the second row (layer17-32) layers opacity should decrease from right to left and so on....
The result should be a perfect gradient from pure white for the first layer and black for the last layer (layer 256).I can not figure out the code so that on odd rows layer's opacity decreases from right to left.Any help appreciated.

In another comp i'd like to fill each layer with a different color.It should look similar to this
<Loading Image...>
layers next to each other ,above or underneath should not have the same color.

Fill expression so far

colors = [[1,0,0,1], // red
[1,1,1,1],
[0,1,0,1], // green
[0,0,1,1], // blue
[1,0,1,1], // magenta
[1,1,0,1], // yellow
[0,1,1,1]] // cyan

seedRandom(index,true);
random(colors.length)

unfortunately,it gives me a 4 dimensional error,why?
Thx
M***@adobeforums.com
2008-08-04 08:38:26 UTC
Permalink
unfortunately,it gives me a 4 dimensional error,why?




Arrays in arrays. If you properly contain all components, you need to call up the components separately again once you have them. You cannot simply assume AE would know which element of the array you are referring to. This only works if you keep the colors "open", e.g. for a simple color shift operation or something. Try this:

pColor=random(colors.length);

[pColor[0],pColor[1],pColor[2],1]

Mylenium
D***@adobeforums.com
2008-08-04 13:22:43 UTC
Permalink
Your opacity expression needs to look something like this:

pRow=Math.ceil(index/16);
pCol=Math.ceil(index-(pRow-1)/16);
if(pRow % 2){
linear(index,1,256,100,0)//odd row
}else {
y = -2*((index - 1)%16 + 1) + 17;
linear(index+y,1,256,100,0)//even row
}

Your color expression needs to look like this:

colors = [[1,0,0,1], // red
[1,1,1,1],
[0,1,0,1], // green
[0,0,1,1], // blue
[1,0,1,1], // magenta
[1,1,0,1], // yellow
[0,1,1,1]] // cyan

seedRandom(index,true);
colors[Math.floor(random(colors.length))]

Getting each layer to be a different color than its neighbors with be a tricky bit of code.

Dan
d***@adobeforums.com
2008-08-05 05:15:54 UTC
Permalink
thank you guys,it works.

Getting each layer to be a different color than its neighbors with be a tricky bit of code.

never mind i do it manually

Continue reading on narkive:
Loading...