[Patchanim-commit] SF.net SVN: patchanim: [33] trunk/patchanim/src/com/mebigfatguy/patchanim/ gui/J
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-01-27 01:59:04
|
Revision: 33
http://patchanim.svn.sourceforge.net/patchanim/?rev=33&view=rev
Author: dbrosius
Date: 2008-01-26 17:59:07 -0800 (Sat, 26 Jan 2008)
Log Message:
-----------
implement Animation Repeat types, None, Cycle and Wave
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:46:13 UTC (rev 32)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:59:07 UTC (rev 33)
@@ -31,6 +31,7 @@
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
+import com.mebigfatguy.patchanim.AnimationType;
import com.mebigfatguy.patchanim.PatchAnimDocument;
import com.mebigfatguy.patchanim.surface.CombinedPatch;
import com.mebigfatguy.patchanim.surface.PatchGenerator;
@@ -42,6 +43,7 @@
private int tweenCount;
private int width;
private int height;
+ private AnimationType type;
private List<CombinedPatch> patches;
private BufferedImage image;
@@ -51,6 +53,7 @@
tweenCount = document.getTweenCount();
width = document.getWidth();
height = document.getHeight();
+ type = document.getAnimationType();
patches = document.getPatches();
initComponents();
@@ -84,6 +87,26 @@
lastRedraw = now;
}
}
+
+ if (type == AnimationType.None)
+ return;
+
+ if (type == AnimationType.Wave) {
+ for (int p = lastPatch; p > 0; p--) {
+ CombinedPatch startPatch = patches.get(p-1);
+ CombinedPatch endPatch = patches.get(p);
+ for (int t = tweenCount - 1; t >= 0; t--) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount);
+ PatchGenerator.recalcCombinedImage(tweenPatch, image);
+ long now = System.currentTimeMillis();
+ long sleepTime = 100 - (now - lastRedraw);
+ if (sleepTime > 0)
+ Thread.sleep(sleepTime);
+ testPanel.redraw();
+ lastRedraw = now;
+ }
+ }
+ }
}
} catch (InterruptedException ie) {
//OK
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|