/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.animation;

import intrinsic.Function;

public class SplinePropertyAnimation extends PropertyAnimation {
	double x1, y1, x2, y2;

public void setSpline(double x1, double y1, double x2, double y2) {
	this.x1 = x1;
	this.y1 = y1;
	this.x2 = x2;
	this.y2 = y2;
}

native Function easingFunction ()/*{
	import mx.effects.easing.*;
	return mx.effects.easing.Cubic.easeInOut;
	//return easeSpline__DDDD; 
}*/;


double easeSpline (double t, double b, double c, double d) {
	double p1 = x1;
	double p2 = x2;
	return ((t/=d)*t*c + 3*(1-t)*(t*(p2-b) + (1-t)*(p1-b)))*t + b;
}

}
