ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Add Value to certain parameter by marker

FAQ   •   VIEW ALL
 Add Value to certain parameter by marker on Jan 2, 2017 at 1:56:21 pm

hey folks,

i got a question concerning marker triggering. I found some expressions which triggers opacity at 100 when a layer marker is reached.
i need two modifications:

- when the timeline hits a layer marker the opacity should fade in in a certain time (variable) then stay at this level for a certain time (variable2) and then decrease at 0 in a certain time (variable3). i have no clou how to archive that.

the second task is that a an object should be rotated every time a layermarker is reached in a certain fade time.

any ideas on that?

thanks a lot guys. cheers

basti

```if (marker.numKeys > 0){ t = marker.nearestKey(time).time; fMarker = timeToFrames(t); f = timeToFrames(time); if (f == fMarker) 100 else 0; }else if (marker.numKeys > 0){ t = marker.nearestKey(time).time; fMarker = timeToFrames(t); f = timeToFrames(time); if (f == fMarker) 100 else 0; }else 0```

 Re: Add Value to certain parameter by markeron Jan 2, 2017 at 4:00:44 pm

Something like this maybe for opacity:

``` attackTime = .1; holdTime = .1; decayTime = .25; n = 0; if (marker.numKeys > 0){ n = marker.nearestKey(time).index; if (marker.key(n).time > time)n--; } if (n > 0){ t = time - marker.key(n).time; t1 = attackTime; t2 = t1 + holdTime; t3 = t2 + decayTime if (t < t1) linear(t,0,t1,0,100) else if (t < t2) 100 else linear(t,t2,t3,100,0); }else 0 ```

and this for rotation:

``` rotateTime = .1; rotateAmt = 30; n = 0; if (marker.numKeys > 0){ n = marker.nearestKey(time).index; if (marker.key(n).time > time)n--; } if (n > 0){ t = time - marker.key(n).time; r = (n-1)*rotateAmt + linear(t,0,rotateTime,0,rotateAmt); value + r; }else value ```

Dan

 Re: Add Value to certain parameter by markeron Jan 7, 2017 at 1:10:34 am

Hello Dan,

thanks man, that works fine for me and saves me a lot of time.
thanks a lot.

basti