Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects raster data expressions

  • raster data expressions

    Posted by Ben Insler on September 9, 2008 at 3:36 pm

    Hey Cow!

    Is there a way to access raster data of a camera through expressions. I’m looking to… say… take the top have the camera look at the upper left corner of the comp, average its pixels into one luma value, and tell me what that value is. Is that possible?

    Thanks,

    Ben

    Dan Ebberts
    replied 17 years, 8 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    September 9, 2008 at 4:16 pm

    To sample the pixel data of a camera view (is that what you’re asking?) you’d have to turn the comp into a precomp and drop it as a layer into another comp, where you could use sampleImage()on it to get at the pixel data. You’ll get back the averaged RGBA values for a rectangular area that you specify. Then you should be able to use rgbToHsl() to do the conversion (I think).

    Dan

  • Ben Insler

    September 10, 2008 at 3:36 pm

    Gotcha. Thanks.

    Turns out I’m using AFX 6.5 (i know…I know…), and that function wasn’t introduced until CS3. So I’ve come up with a new idea for driving the effect I’m looking for, but I’m having trouble with the driving expression. Can you have one expression, in one layer, drive many other layers. For example, if I have 10 solids (solid01 – solid10) in compA, and another solid (driver01) in CompB, can an expression use driver01.rotation to control the rotation of all 10 solids, without writing an expression for each?

    I was hoping to do something along the lines of this in the rotation attribute of the driver solid (and I don’t know if the syntax is write here, just using it as an example):

    for(i = 1, i<=10, i++) comp("compA").layer(i).rotation = rotation; The results of this don't calculate onto solid01 - solid10. However, if I write an expression for each solid's rotation in compA referencing the driver's rotation, everything works. Any way to just have one expression drive all? Thanks again! Ben

  • Dan Ebberts

    September 10, 2008 at 3:42 pm

    Nope, sorry. An expression can’t control anything except the property to which it’s applied.

    Dan

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