[Patchanim-commit] SF.net SVN: patchanim:[262] trunk/patchanim/src/com/mebigfatguy/patchanim
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-12-26 01:52:55
|
Revision: 262 http://patchanim.svn.sourceforge.net/patchanim/?rev=262&view=rev Author: dbrosius Date: 2008-12-26 01:52:53 +0000 (Fri, 26 Dec 2008) Log Message: ----------- put in tween algos Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 00:14:24 UTC (rev 261) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 01:52:53 UTC (rev 262) @@ -22,6 +22,7 @@ import java.util.ResourceBundle; import com.mebigfatguy.patchanim.main.PatchAnimBundle; +import com.mebigfatguy.patchanim.surface.PatchGenerator; /** * denotes the algorithm to use to tween two patches @@ -45,13 +46,20 @@ private static final String TWEEN = "tweenstyle."; private Point[] points; + private double[] coeffs; private TweenStyle(Point... pts) { points = pts; + coeffs = new double[4]; } public double transform(double frac) { - return frac; + PatchGenerator.buildCoefficients(frac, coeffs); + double out = 0.0; + for (int i = 0; i < 4; i++) { + out += coeffs[i] * (points[i].y / 100.0); + } + return out; } /** Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 00:14:24 UTC (rev 261) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 01:52:53 UTC (rev 262) @@ -199,7 +199,7 @@ return image; } - private static void buildCoefficients(double t, double[] coeffs) { + public static void buildCoefficients(double t, double[] coeffs) { double tt = 1.0; for (int i = 0; i < coeffs.length; i++) { coeffs[i] = tt; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |