[Patchanim-commit] SF.net SVN: patchanim:[258] trunk/patchanim/src/com/mebigfatguy/patchanim/ surfa
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-12-25 20:20:46
|
Revision: 258
http://patchanim.svn.sourceforge.net/patchanim/?rev=258&view=rev
Author: dbrosius
Date: 2008-12-25 20:20:43 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
do linear tweening right
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-25 18:52:27 UTC (rev 257)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-25 20:20:43 UTC (rev 258)
@@ -86,14 +86,17 @@
PatchCoords tweenCoords = new PatchCoords(startCoords.getOrder());
switch (tweenStyle) {
case Linear:
- /* this only works if the lattice is fixed */
for (int x = 0; x < tweenCoords.order; x++) {
for (int y = 0; y < tweenCoords.order; y++) {
Coordinate startC = startCoords.getCoordinate(x,y);
Coordinate endC = endCoords.getCoordinate(x,y);
+ double startX = startC.getX();
+ double startY = startC.getY();
double startColor = startC.getColor();
+ double tweenX = (startX + (endC.getX() - startX) * frac);
+ double tweenY = (startY + (endC.getY() - startY) * frac);
int tweenColor = (int)(startColor + (endC.getColor() - startColor) * frac);
- Coordinate tweenC = new Coordinate(startC.getX(), endC.getY(), tweenColor);
+ Coordinate tweenC = new Coordinate(tweenX, tweenY, tweenColor);
tweenCoords.setCoordinate(x, y, tweenC);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|