ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Can i get a "figed time"?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Fabrice Boulard
Can i get a "figed time"?
on Feb 12, 2018 at 4:06:22 pm

Hi everybody!
I did a metronome. The vertical bar is animated by a simple expression :
var amplitude = 32;
var bpm = 120; (beatPerMinute)
var f = (bpm/60)*2; (frequence)
sin(2*Math.PI*f*time)

Now i want to play a sound at the right time. It's why i created a comp. Into this, a only one soundlayer with a marker at the frame number 1 (not 0).
I commented this marker : "playSound".

I addded this comp in another comp to time remaptime it and add expression on it :

var c = thisLayer.source;
var myComment = "playSound";
var m= c.marker.key(myComment);

var amplitude = 32;
var bpm = comp('metronome').layer('barre').effect("Paramètre glissière")("Curseur");
var velocité = 2*Math.PI*((bpm/60)/2);

var v = amplitude*Math.sin(velocité * time);

frames = timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false);
iTime = framesToTime(frames+1, fps = 1.0 / thisComp.frameDuration);
iV = amplitude*Math.sin(velocité * iTime);


absV = Math.abs(v);
absiV = Math.abs(iV);

if(absV == amplitude || (absV<amplitude && absiV<absV)) {

m.time + time (here is the problem)


}else{
i=0
}


I need to substract the time value when the condition begins true and i don't know how to do that...
"m.time + time - figedTime"

Thx for help


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]