Page 1 of 1

Distributing Photos over a solid

Posted: September 4th, 2008, 3:42 am
by zevoice
Hi there,

I'm new in this site, that i discover recently. So first of all Hi !!! Please apologize my poor english since it's not my common language.

I'm a newby in expression and i have an animation to make :

I have 300 photos that i want to distribute over a solid of 3000 X 500 px. A camera over it will slide horizontally. Each time the camera will be on top of a photo, the photo will reveal gradually.

So i'v tried to distribute the photos with that expression :

Code: Select all

seedRandom( thisComp.layer("table").width , true ) ;
random( [width/2,height/2], [ thisComp.layer("table").width/2, thisComp.layer("table").height-height/2] )
"Table" is the name of my solid. But curiously all the photos group at one point, about the left hand corner.

To reveal the photos, i've used this (thanks Dan Ebbert for this piece of code):

Code: Select all

rampTime = 1;

if (thisComp.layer("Caméra 1").transform.position[1] <= transform.position[1]){

linear(time,time,time + rampTime,0,100)

}
But it not fade in just appear... :cry:

I try my best to work on it on my own, but now i'm going nut. So please, can anybody help me ?

Re: Distributing Photos over a solid

Posted: September 4th, 2008, 7:53 am
by Dan Ebberts
This should take care of your random distribution:

table = thisComp.layer("table");
seedRandom( index , true );
offset = random( [width,height]/2, [ table.width - width/2, table.height - height/2] )
table.toWorld([0,0,0]) + offset

The fade in is more problematic. If you want a one-second fade in that's triggered based on proximity to the camera, that's going to require a looping expression that goes back in time looking for the triggering event (which you have to define, by the way). If you just want the layers' opacity to be a function of the layer's distance from the camera, that's easier - but you still have to define the parameters.


Dan

Re: Distributing Photos over a solid

Posted: September 6th, 2008, 6:02 am
by zevoice
Thank you very much Dan, the distribution works perfectly.

But I don't really understand what you mean when you said
Dan Ebberts wrote:If you just want the layers' opacity to be a function of the layer's distance from the camera, that's easier - but you still have to define the parameters.
Thanks again !

Re: Distributing Photos over a solid

Posted: September 6th, 2008, 8:33 am
by Dan Ebberts
I think you're after something like this:

Code: Select all

rampTime = 1;
if (thisComp.activeCamera.transform.position[1] > transform.position[1]){
  0
}else{
  t0 = time;
  while (thisComp.activeCamera.transform.position.valueAtTime(t0)[1] <= transform.position[1]){
    t0 -= thisComp.frameDuration;
  }
  t = time - t0 + thisComp.frameDuration;
  linear(t,0,rampTime,0,100)
}
Dan