Animating With Markers & Duplicate Keying

Scripting for After Effects

Animating With Markers & Duplicate Keying

Postby IceMetalPunk on 03/13/2011, 12:19 am

So I just found Dan Ebberts's "Animation Triggering with Markers" tutorial (found here: http://www.motionscript.com/design-guid ... -sync.html ). It works great...that is, until I try to trigger the same action more than once in the main comp. If I do that, the very first action will work, but all the others after that error-out to 0.

I'm using the code posted in the tutorial verbatim:

Code: Select all
action = comp(name).layer("action");

n = 0;
if (marker.numKeys > 0){
  n = marker.nearestKey(time).index;
  if (marker.key(n).time > time){
    n--;
  }
}

if (n == 0){
  0
}else{
  m = marker.key(n);
  myComment = m.comment;
  t = time - m.time;
  try{
    actMarker = action.marker.key(myComment);
    if (action.marker.numKeys > actMarker.index){
      tMax = action.marker.key(actMarker.index + 1).time - actMarker.time;
    }else{
      tMax = action.outPoint - actMarker.time;
    }
    t = Math.min(t, tMax);
    actMarker.time + t;
  }catch (err){
    0
  }
}


I can't see why it would be a problem to have multiple markers with the same comment, to trigger the same animation in different places... seems like it should work to me, since the "action" layer in the precomp DOES NOT have duplicates...

Any help?

-IMP ;) :)

*EDIT* Found the problem, but don't know what's causing it. For some reason, AE is randomly adding new lines at the end of my marker comments, but not every time. Just when it feels like it (which of course means the marker names aren't matching correctly). Why is it adding these new lines and why not consistently?
IceMetalPunk
 
Posts: 7
Joined: 11/20/2010, 3:51 pm

Re: Animating With Markers & Duplicate Keying

Postby FACELESS on 03/13/2011, 1:52 am

Ngambles is the guy to talk to about this me thinks
after effects is like cake.....hmmm cake
FACELESS
 
Posts: 1388
Joined: 05/12/2009, 3:59 am

Re: Animating With Markers & Duplicate Keying

Postby ngambles on 03/14/2011, 8:08 pm

No need for my help. Stop hitting the return key and just hit the 'OK' button to get out of the Layer Marker dialog box. This should help prevent line returns.
ngambles
 
Posts: 1216
Joined: 09/20/2008, 12:47 pm
Location: Colorado Springs, CO USA

Re: Animating With Markers & Duplicate Keying

Postby bstasiya on 11/24/2015, 2:18 pm

Any idea why this does not hold true for the original script?
"when we trigger an action, the playback of that action stops before running into the next action."

For me, the keyframes following the one that i've called by the marker in the outercomp play anyway, whereas the expression is supposed to hold on the last keyframe after the called marker.
bstasiya
 
Posts: 1
Joined: 11/24/2015, 2:16 pm
System Specs: mac pro (mid 2010)


Return to After Effects Expressions