[Patchanim-commit] SF.net SVN: patchanim:[267] trunk/patchanim/src/com/mebigfatguy/patchanim/ Tween
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-12-28 06:26:03
|
Revision: 267 http://patchanim.svn.sourceforge.net/patchanim/?rev=267&view=rev Author: dbrosius Date: 2008-12-28 06:25:42 +0000 (Sun, 28 Dec 2008) Log Message: ----------- fix the tween styles Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-28 06:11:15 UTC (rev 266) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-28 06:25:42 UTC (rev 267) @@ -18,7 +18,6 @@ */ package com.mebigfatguy.patchanim; -import java.awt.Point; import java.util.ResourceBundle; import com.mebigfatguy.patchanim.main.PatchAnimBundle; @@ -32,24 +31,24 @@ * <li><b>Decelerating</b> Control points are tweened decelerating from start to finish</li> * <li><b>EaseInEaseOut</b> Control points are tweened eased in from start, then eased out to finish</li> * <li><b>Accelerating</b> Control points are tweened accelerating in from start and then accelerated out to finish</li> - * <li><b>Accelerating</b> Control points are tweened waved from start to finish</li> + * <li><b>Wave</b> Control points are tweened waved from start to finish</li> * </ul> */ public enum TweenStyle { - Linear(new Point(0, 0), new Point(0, 0), new Point(100, 100), new Point(100, 100)), - Accelerating(new Point(0, 0), new Point(100, 0), new Point(100, 100), new Point(100, 100)), - Decelerating(new Point(0, 0), new Point(0, 100), new Point(100, 100), new Point(100, 100)), - EaseInEaseOut(new Point(0, 0), new Point(50, 0), new Point(50, 100), new Point(100, 100)), - AccelerateInAccelerateOut(new Point(0, 0), new Point(0, 50), new Point(100, 50), new Point(100, 100)), - Wave(new Point(0, 0), new Point(0, 200), new Point(100, -200), new Point(100, 100)); + Linear(0, 1.0/3.0, 2.0/3.0, 1), + Accelerating(0, 0, 0, 1), + Decelerating(0, 1, 1, 1), + EaseInEaseOut(0, 0.0, 1, 1), + AccelerateInAccelerateOut(0, 1, 0, 1), + Wave(0, 2, -1, 1); private static final String TWEEN = "tweenstyle."; - private Point[] points; + private double[] ys; private double[] coeffs; - private TweenStyle(Point... pts) { - points = pts; + private TweenStyle(double... ys) { + this.ys = ys; coeffs = new double[4]; } @@ -57,7 +56,7 @@ PatchGenerator.buildCoefficients(frac, coeffs); double out = 0.0; for (int i = 0; i < 4; i++) { - out += coeffs[i] * points[i].y / 100; + out += coeffs[i] * ys[i]; } return out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |