 |
|
|
|
|
|
|
 |
08-04-2008, 01:22 AM
|
#1
|
|
Guest
|
Opacity expression
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)
In another comp i'd like to fill each layer with a different color.It should look similar to this
<http://img388.imageshack.us/img388/2644/bild2yr8.png>
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
|
|
|
|
08-04-2008, 04:38 AM
|
#2
|
|
Guest
|
Re: Opacity expression
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
|
|
|
|
08-04-2008, 09:22 AM
|
#3
|
|
Guest
|
Re: Opacity expression
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
|
|
|
|
08-05-2008, 01:15 AM
|
#4
|
|
Guest
|
Re: Opacity expression
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Microsoft Newsgroups 1 | Software Newsgroups
Powered by: vBulletin Version 3.0.7 Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2003-2004 All Rights Reserved GroupBrowser LLC.
|
 |