Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
So one thing I noticed with Ease & Wizz is that there's no setting exactly like AE's Exponential Scale animation assistant. I've written the author and asked to include a 'linear' interpolation as all of E&W's options use some sort of easing.
So he gave me this expression by Dan to use. But I'm getting a "div() must be scalar" error when I place use it in a scale property. Can someone take a look and see what's wrong?
if (numKeys > 1){v1 = key(1).value;v2 = key(2).value;t1 = key(1).time;t2 = key(2).time;if (time > t1 && time < t2){t = time - t1;T = t2 - t1;k = Math.log(v2/v1)/T;v1*Math.exp(k*t)}else{value}}else{value}
Copy link to clipboard
Copied
Are you using this on a 2- or 3-dimensional property? I think the problem is here:
k = Math.log(v2/v1)/T;
The expression looks like it was written for a one-dimensional property, not for vectors like scale or position. I think v2/v1 is another way of expressing div(v2, v1). In any case, you are trying to divide a vector by another vector.
My vector math was never very good, so I'm not sure what the solution is at this point. I suspect it is more complicated than simply dividing each component of v2 by its corresponding component of v1.
Copy link to clipboard
Copied
I think this should work for what you're trying to do. For two keyframes it should give the same result as if you applied AE's exonential scale. If there are more than two keyframes, it will apply the exponential scale between each adjacent pair of keyframes. Should work for multi-dimensional properties as well. I just took it out of the oven, so it may not be completely cooked. Let me know if you run into problems.
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0 || n == numKeys){
value
}else{
d = 1
try{
value[1];
d++;
value[2];
d++;
value[3];
d++;
}catch (err){
}
t1 = key(n).time;
t2 = key(n+1).time;
if (d == 1){
v1 = key(n).value;
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value;
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v1/Math.exp((time-t1)*k)
}else{
v = [];
for(i = 0; i < d; i++){
v1 = key(n).value;
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value;
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v = v1/Math.exp((time-t1)*k)
}
v
}
}
Dan
Copy link to clipboard
Copied
Wow! Thanks Dan! I'll give it a whirl tomorrow morning!
Copy link to clipboard
Copied
SUCCESS!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Wow, that's an old one. It looks like it isn't rigged to handle multi-dimensional properties (even though I said it should be). That's a lot of code. I haven't looked at it too much, but this should be a lot better:
val = value;
if (numKeys > 1){
n = nearestKey(time).index;
if (key(n).time > time) n--;
if ((n > 0) && (n < numKeys)){
d = key(n+1).time-key(n).time;
dv = key(n+1).value-key(n).value;
t = (time-key(n).time)/d;
val = key(n).value + dv*Math.exp(10*(t-1));
}
}
val