Andres Torres
Forum Replies Created
-
I agree..this expression is insanely useful!
I’d like to alter the expression to begin with the last letter and end
on the first letter. -
I actually found a previous post. Does this seem logical (I added an amp factor with a slider)?
// https://forums.creativecow.net/thread/227/18170freq = effect("Freq")("Slider");
decay = effect("Decay")("Slider");n = 0;
p = thisPropertyif (p.numKeys > 0){
n = p.nearestKey(time).index;
if (p.key(n).time > time) n--
}if (n > 0){
t = time - p.key(n).time;
amp = p.velocityAtTime(p.key(n).time - .001)*effect("Amp")("Slider");w = freq*Math.PI*2;
amp *= Math.floor(t*freq*2)%2 ? 1 : -1; value + amp* Math.sin(t*w)/Math.exp(decay*t)/w
}else{
value
} -
I’ve been trying this one from your site, but it behaves so different than my initial expression no matter how I play with my sliders for the variables. How would we keep my initial expression, but with a clamp on the second keyframe?
e = .7;
g = 5000;
nMax = 9;n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
v = -velocityAtTime(key(n).time - .001)*e;
vl = length(v);
if (value instanceof Array){
vu = (vl > 0) ? normalize(v) : [0,0,0];
}else{
vu = (v < 0) ? -1 : 1;
}
tCur = 0;
segDur = 2*vl/g;
tNext = segDur;
nb = 1; // number of bounces
while (tNext < t && nb <= nMax){
vl *= e;
segDur *= e;
tCur = tNext;
tNext += segDur;
nb++
}
if(nb <= nMax){
delta = t - tCur;
value + vu*delta*(vl - g*delta/2);
}else{
value
}
}else
value -
Works great, thanks.
-
I keep getting this error with the expression when I change the freq and decay values.
invalid numeric result (divide by zero?)
Error occuredat line 13
Property: ‘Position’I tried your suggested values and the position always returns to the last keyframed value. I’m looking to go past the keyframe and ease to a stop based on velocity and a friction variable.
Thanks.
-
Thanks Dan, you’re amazing.
-
So there’s 3 parts to this:
1. A fade out that lasts for 20 frames that begins -10 frames from the marker (or 10 frames before the marker)
2. hold the opacity at zero until 50 frames after the marker.
3. A fade in that lasts for 20 frames and begins 50 frames after the marker.
The expression below doesn’t exactly achieve this:
startOutDown = -10; // frames from marker
fadeOutFrames = 20; // duration of fade
startFadeUp = 50 // frames from marker
fadeUpFrames = 20; // duration of fadeif (marker.numKeys > 0){
t = marker.nearestKey(time).time;
if (t > time){
easeOut(time,t+startFadeOut+framesToTime(fadeOutFrames),t,100,0);
}else{
easeIn(time,t,t+startFadeUp+framesToTime(fadeUpFrames),0,100);
}
}else{
value
}This approach may be more robust:
1. A fade out that lasts for 20 frames that begins -10 frames from the marker (or 10 frames before the marker)
2. hold the opacity a specified number of frames, then begin a fade in that lasts for 20 frames.
-
This is good. The only thing it’s missing is a fadeWidth variable to control how many frames to hold the opacity at zero.
-
I meant to be more specific…I should have specified the need to have control over when the fade-out begins and when the fade-in begins in relation to the marker. It will not be timed evenly on either side, i.e., the fade-out would probably begin more like 200 frames before the marker and the fade-in would begin about 60 frames after the marker.
Thanks again,
Andres -
This expression worked flawlessly.
I would like the markers to trigger an additional event. I need to have the opacity fade down about 30 frames before the marker and fade back up about 40 frames after the marker.
I know the marker fades are traditionally measured by milliseconds, frames would be preferred if possible.
-Andres