Ease and wizz script on markers instead of keyframe

What type of scripts do you need?

Moderator: byronnash

Post Reply
jeremix
Posts: 1
Joined: September 15th, 2010, 2:41 am

Hi,

I'm new here, and new to AE scripts too...
I succeed to modify a script that fits my needs. It simply fires a "slide effect" of 15 images for each of my layer's marker:

Code: Select all

f=15; //duration
d=-768; // 768 pixels slide from right to left

f=framesToTime(f, fps = 1.0 / thisComp.frameDuration);
n = 0;
if (marker.numKeys > 0){
  n = marker.nearestKey(time).index;
  if (time < marker.key(n).time && n > marker.numKeys){
   n++;
  }
r=(d*(n-1)) + value;
ease (time,marker.key(n).time,marker.key(n).time+f,r,r+d);
}
The only thing is that the easing is not very good.
I've found the Ease & Wizz, which is much better for what i want to do, but i don't manage to modify it to fire on a marker basis instead of keyframe. Any idea ? Thanks !

Code: Select all

// Curvaceous - all keyframes
// 2.0 : inOutQuart
// Ian Haigh (http://ianhaigh.com/easeandwizz/)
// Last built: 2009-01-08T11:11:54+11:00


function inOutQuart(t, b, c, d) {
	if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
	return -c/2 * ((t-=2)*t*t*t - 2) + b;

}

function curvaceous() {
	var n = 0;
	if (marker.numKeys > 0) {
		n = marker.nearestKey(time).index;
		if (time < marker.key(n).time && n < marker.numKeys){n++;}
	}

	// after the first two keys, yet before the last two, just do nothing
	if (n > 1 && n < marker.numKeys -1 ) {
		return null;
	}

	try {
		var key1 = marker.key(n);
		//var key2 = marker.key(n+1);
	} catch(e) {
		return null;
	}
	
	t = time - key1.time;
	d = (key1.time + 15) - key1.time;

	sX = key1.time;
	eX = key1.time + 15;


	if ((time < key1.time) || (time > key1.time + 15)) {
		return null;
	} else {
		return valueAtTime(inOutQuart(t, sX, eX, d));
	}
}

(curvaceous() || value);

Post Reply