Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Time Remap pre-comp through Control Layer?

  • Time Remap pre-comp through Control Layer?

    Posted by Rob Wienk on March 12, 2015 at 11:00 am

    Hi everyone,

    I’ve been trying to set up a comp that contains 1. a pre-comp with an animation inside, and 2. a control-layer that has a mask animate from black to white.

    The idea is that each pre-comp looks at the pixel value of the control-layer, and when this turns from black to white, the pre-comp will start.
    So to clarify, the InPoint of the pre-comp effectively should get moved to the point in time where the control-layer turns from black to white underneath the pre-comp.

    The idea behind all this is that I could make duplicates of the pre-comp to create a grid of animation that are all the same but that would be offset in time by the animation of the mask in the control-layer.

    I’ve tried a few different things but I can’t get the code to work. The problem seems to be that I’d need a way to store a value (the frame number where the control-layer turns from black to white under that pre-comp), which as far as I know is impossible with AE expressions. So I was wondering if anyone else might have a solution or a different approach.

    The code I have so far (I should mention that the animation in the pre-comp runs from frame 0-15):

    // This code is put the Time Remap property of the animation pre-comp
    var controlLayer = thisComp.layer(“Control Layer”);
    var colorValue = controlLayer.sampleImage([1,1], transform.position)
    var controlValue = Math.floor(colorValue[0]);

    if( controlValue ) {
    timeRemap + 1.0*controlValue/30;
    } else {
    0;
    }

    // LINEAR APPROACH, also doesn’t work:
    // offset = timeToFrames(time) * controlValue;
    // var targetFrame = linear(time*controlValue, time, time+15, 0, 15);

    Walter Soyka replied 11 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Rob Wienk

    March 12, 2015 at 4:51 pm

    Sure you could. However, the idea is that the setup that I’m after, will be a lot more flexible.

    I could animate 10 different masks, and have ten animations, with just a few keyframes (on the masks).
    If I would want to achieve the same effect without the expression, I’d have to time-offset maybe 45+ pre-comps (my current grid-setup has 45 pre-comps. I could imagine a setup that has up to twice as many). Then it will be much more time consuming to do so.

    On a side note:
    I seem to have placed this thread in the general AE forum. I suppose it would be better to move it to the part that’s specifically for AE Expressions.
    I’d appreciate it If someone could do this for me.

  • Walter Soyka

    March 12, 2015 at 5:50 pm

    Check out the time displacement effect, which will do this for you without the slow expression evaluation.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

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