Forum Replies Created

Page 14 of 1081
  • Dan Ebberts

    November 6, 2024 at 8:54 pm in reply to: expressions linking comps by name or index

    If the layers are in the same layer order in their respective comps, you should be able to do something like this:

    comp("SOLID_Goat").layer(index).transform.opacity
  • Dan Ebberts

    November 6, 2024 at 8:49 pm in reply to: Expressions that work in all languages, best practises

    I think it’s safe to use the name of anything that’s been re-named, so in your example I think you’d be OK using “myCtrl 1”.

  • Dan Ebberts

    November 5, 2024 at 12:11 am in reply to: Custom pixel design sequence based on color mapping

    The sampleImage() opacity expression could look something like this for your “1” layers:

    mc = [.482,.933,.557]; // match color (bright green)
    t = .01; // tolerance
    L = thisComp.layer("pixel-motion.gif");
    c = L.sampleImage(position,[.5,.5],false,time);
    Math.abs(c[0]-mc[0])<t && Math.abs(c[1]-mc[1])<t && Math.abs(c[2]-mc[2])<t ? 100 : 0
  • Dan Ebberts

    November 4, 2024 at 10:23 pm in reply to: Custom pixel design sequence based on color mapping

    Wow. Off the top of my head, I think that would take some pretty complex rigging. It seems like your matrices of numbers would have to be individual layers, rather than a single layer with CC RepeTile applied. Each layer would have an opacity expression that uses sampleImage() to extract the color from its location on the pixel motion layer. Then it would check to see if the sampled color is within a small range of colors (you probably wouldn’t want to try and match a specific color exactly), and if so, set opacity to 100%, otherwise 0. I don’t know if that’s the best approach, or even practical, but theoretically, I think it would work.

  • Dan Ebberts

    November 4, 2024 at 6:12 pm in reply to: Custom pixel design sequence based on color mapping

    It sounds interesting, and I’d like to help, but I can’t picture what you have in mind. More detail might be helpful.

  • Dan Ebberts

    November 2, 2024 at 12:51 am in reply to: Persistent state between frames

    Scripting doesn’t operate in real time like expressions, it’s more suited to building and manipulating comps, layers, etc. in more of a batch environment.

    You may still be able to use an expression for what you’re trying to do, you just need to work around the “expressions have no memory” constraint. What is it, exactly, that you want to do?

  • Except that valueAtTime() won’t give you the last calculated value. I think you can do what you’re suggesting with just this:

    var dur = 10;
    linear (time,0,dur,value, value + [100,100]);
  • Dan Ebberts

    November 1, 2024 at 10:42 pm in reply to: Persistent state between frames

    Scripting is a completely different story, but you can’t do it with expressions. It’s not hard to figure out why it has to be that way. In AE you can move to any frame in the timeline and it needs to render. If that depended on whether some persistent variable might have been modified somewhere in the frames that you skipped over, chaos would ensue. It was a deliberate design decision that expressions have no memory.

  • Expressions have no memory, so they don’t have access to previous values calculated by that expression. Anytime an expression refers to the property hosting the expression with value or valueAtTime(), it gets the pre-expression value (as if the expression didn’t exist). There’s no way for it to get the post-expression value except to re-calculate it.

    Strangely though, when an expression refers to any other property, it gets the post-expression (if there is one) value.

  • Dan Ebberts

    October 31, 2024 at 3:52 pm in reply to: marker.numKeys works sometimes, sometimes not

    You can minimize the code a little like this:

    m = thisComp.layer("Notes").marker;
    v = "";
    if (m.numKeys > 0){
    k = m.nearestKey(time).index;
    if (time < m.key(k).time) k--;
    if (k > 0) v = m.key(k).comment;
    }
    v
Page 14 of 1081

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