// Ease and Wizz 2.5.3 : Curvaceous : inoutBounce : all keyframes
// Ian Haigh (http://aescripts.com/ease-and-wizz/)
// Last built: 2017-08-08T09:11:05+10:00

function easeandwizz_outBounce(t, b, c, d) {
	if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b }
	else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b }
	else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b } 
	else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b }
}

function easeandwizz_inBounce(t, b, c, d) {
	return c - easeandwizz_outBounce (d-t, 0, c, d) + b;
}

function easeandwizz_inoutBounce(t, b, c, d) {
	if (t < d/2) return easeandwizz_inBounce (t*2, 0, c, d) * .5 + b;
	else return easeandwizz_outBounce (t*2-d, 0, c, d) * .5 + c*.5 + b;
}


function easeAndWizz() {
	var n = 0;
	if (numKeys > 0) {
		n = nearestKey(time).index;
		if (key(n).time > time) { n-- }
	}

	try {
		var key1 = key(n);
		var key2 = key(n+1);
	} catch(e) {
		return null;
	}

	t = time - key1.time;
	d = key2.time - key1.time;

	sX = key1.time;
	eX = key2.time - key1.time;


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

(easeAndWizz() || value);
