Distributing Photos over a solid

Moderators: Disciple, zlovatt

Post Reply
zevoice
Posts: 2
Joined: September 4th, 2008, 2:29 am

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 ?
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

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
zevoice
Posts: 2
Joined: September 4th, 2008, 2:29 am

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 !
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

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
Post Reply