Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Rob Moffett on May 20, 2009 at 4:50 am

    I was playing with Dan’s sampleimage expressions, and would like to have the alpha value of a specified layer control the rotation of a layer.

    I pasted this expression on the Y-axis of my layer…

    target = thisComp.layer(“background”);
    a=target.sampleImage(transform.position, [width, height]/2, true, time)[3];
    linear(a, 0, 0.36, 0, 180)

    But get this error: sampleimage() must be 2 numbers
    What am I doing wrong? Was I close?

    Rob Moffett replied 16 years, 12 months ago 1 Member · 2 Replies
  • 2 Replies
  • Rob Moffett

    May 20, 2009 at 5:01 am

    Ok, so I discovered that the error “must be 2 numbers” is because the layer i want to effect is a 3D layer, and is returning 3 numbers (xyz)

    Is there a way around this, or is the sampleimage expression limited to 2D?

  • Rob Moffett

    May 20, 2009 at 5:06 am

    Ha, worked it out. Here’s the solution if anyone wants it.

    target = thisComp.layer(“background”);
    a=target.sampleImage([transform.position[0],transform.position[1]], [width, height]/2, true, time)[3];
    value=linear(a, 0, 0.36, 0, 180)

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