I guess there would be a couple of approaches. One would be to sample the value at a small amount of time on both sides of the target time and use those to calculate the velocity. Or, temporarily apply an expression, harvest the value, and delete the expression.
You could capture the error using try/catch, like this example:
var myLayer = app.project.activeItem.layer(1); var myEffect = "xxxx"; try{ myLayer.property("Effects").addProperty(myEffect); }catch(err){ alert('"' + myEffect + '" is not a valid effect name.'); }
What do you mean by “1st layer”, “2nd layer”, etc.?
If you mean that you have a chain of parented layers and you want each one farther down the chain to have more offset, you could do something like this:
L = thisLayer; offset = 100; while(L.hasParent){ offset += 10; L = L.parent; } value + offset
Ah yes. So if you just wanted to map the scale property actions of your button markers to the scale property marker animations on your null, you’d to need to modify it to something like this:
action = thisComp.layer("ANIM BUTTON"); n = 0; if (marker.numKeys > 0){ n = marker.nearestKey(time).index; if (marker.key(n).time > time){ n--; } } if (n == 0){ curT = 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 - thisComp.frameDuration; }else{ tMax = action.outPoint - actMarker.time; } t = Math.min(t, tMax); curT = actMarker.time + t; }catch (err){ curT = 0; } } action.scale.valueAtTime(curT)