Skip navigation
breonsnow
Currently Being Moderated

Help with 3D Layer Position Expression

Sep 23, 2012 9:54 AM

Hi All,

 

I do hope some one can help me – I have been looking and trying to solve this expression problem I have run in to - I only have limited expression knowledge.

 

I need to move a layer in 3D space, only the Z axis: from lets say -50 to 0 (based on the start of the layer) and then stop and then move 0 to 50 (again based on the end of the layer)

 

I have multiple layers of different lengths that I want to add this to…then just adjust the layer to the time to be displayed on the screen.

 

I have used some code from Harry Frank, his AUTO FADE code (which is a god sent) and have tried to make the above movement possible, with sections of the code, its close but no cigar – the code:

 

//Auto Move Z

x = 0;

y = 0;

z = 50;

transition = 20;       // transition time in frames

if (marker.numKeys<2){

tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds

linear(time, inPoint, inPoint + tSecs, thisLayer.position + [x,y,z],0) - linear(time, outPoint - tSecs, outPoint, thisLayer.position +  [x,y,z],0)

}else{

linear(time, inPoint, marker.key(1).time, thisLayer.position + [x,y,z],0) - linear(time, marker.key(2).time, thisLayer.position + [x,y,z],0)

}

 

It is moving but it’s moving on all axis and the OUT is moving backwards instead for forwards. Plus is has moved from the centre position.

 

Any help would be most appreciated, thank you in advance for any help!

 

Cheers Breon

 

Message was edited by: breonsnow - spelling

 
Replies
  • Currently Being Moderated
    Aug 25, 2012 8:49 AM   in reply to breonsnow

    I think this does what you're asking for:

     

    z = 50;

    tf = 20;

     

    tSec = framesToTime(tf);

    if (time < (inPoint + outPoint)/2)

      linear(time,inPoint,inPoint+tSec,value-[0,0,z],value)

    else

      linear(time,outPoint-tSec,outPoint+tSec,value,value+[0,0,z])

     

     

    Dan

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 25, 2012 10:55 AM   in reply to breonsnow

    Ooops. There was an error in the last line. Hopefully you caught it. If not, here's the corrected version:

     

    z = 50;

    tf = 20;

     

    tSec = framesToTime(tf);

    if (time < (inPoint + outPoint)/2)

      linear(time,inPoint,inPoint+tSec,value-[0,0,z],value)

    else

      linear(time,outPoint-tSec,outPoint,value,value+[0,0,z])

     

     

    Dan

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points