Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is this expression possible?

  • Is this expression possible?

    Posted by Erin Shelby on September 13, 2005 at 4:55 pm

    Is it possible to write an expression where something is triggered by an objects perimeter touching something?

    For example: a Square that scales upward until it hits title safe – then stops.
    Or a Circle that moves in X until it hits another layer which causes it to stop.

    No need to write the actual code, maybe psudeo-code or a point in the right direction. Specifically I’m trying to figure out which actual command to use if there is perimeter triggers.

    Dan Ebberts replied 20 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 13, 2005 at 5:25 pm

    There aren’t built-in triggers for stuff like that, but you can still do it (but it can get kind of messy). Here’s an example. This expression will scale up a square over three seconds so that it stops at title safe (10/90%).

    
    scaleTime = 3;
    
    if (position[0] > thisComp.width/2){
      xScale = (thisComp.width*.9 - position[0])/(width/2);
    }else{
      xScale = (position[0] - thisComp.width*.1)/(width/2);
    }
    if (position[1] > thisComp.height/2){
      yScale = (thisComp.height*.9 - position[1])/(height/2);
    }else{
      yScale = (position[1] - thisComp.height*.1)/(height/2);
    }
    s = Math.min(xScale,yScale);
    
    linear(time,0,scaleTime,valueAtTime(0),[s,s]*100)
    
    
    

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy