[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst
From: |
Matti Katila |
Subject: |
[ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst |
Date: |
Sun, 26 Oct 2003 10:40:54 -0500 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Matti Katila <address@hidden> 03/10/26 10:40:54
Modified files:
doc/pegboard/animation_api--mudyc: peg.rst
Log message:
last example still missing
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/doc/pegboard/animation_api--mudyc/peg.rst.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: libvob/doc/pegboard/animation_api--mudyc/peg.rst
diff -u libvob/doc/pegboard/animation_api--mudyc/peg.rst:1.16
libvob/doc/pegboard/animation_api--mudyc/peg.rst:1.17
--- libvob/doc/pegboard/animation_api--mudyc/peg.rst:1.16 Sat Oct 25
10:28:27 2003
+++ libvob/doc/pegboard/animation_api--mudyc/peg.rst Sun Oct 26 10:40:54 2003
@@ -5,8 +5,8 @@
:Authors: mudyc
:Date-Created: 2003-09-27
-:Last-Modified: $Date: 2003/10/25 14:28:27 $
-:Revision: $Revision: 1.16 $
+:Last-Modified: $Date: 2003/10/26 15:40:54 $
+:Revision: $Revision: 1.17 $
:Status: Current
:Stakeholders: mudyc, tjl, benja
:Scope: Minor
@@ -162,6 +162,131 @@
* <code>rerender</code> are pending state methods, i.e.,
* the time when the operation of the method is accomplished
* is (undetermined) soon but not immediately.
+ * <p>
+ *
+ * Examples:
+ * <ol><li>
+ * Example: When you want to interpolate a red box from left to right
+ * you could do it, like:
+ * <pre>
+ * class Scene:
+ * """ Example scene to animate red box from left to right
+ * and backwards.
+ * """
+ * def __init__(self, windowAnimation):
+ * self.windowAnimation = windowAnimation
+ * self.keyHit = 0
+ * self.left = 100
+ * self.right = 500
+ * def scene(self, vs):
+ * if self.keyHit == 0:
+ * cs = vs.orthoBoxCS(0, "RedBox", 0,self.left,
+ * 50, 1,1, 100,100)
+ * else:
+ * cs = vs.orthoBoxCS(0, "RedBox", 0,self.right,
+ * 50, 1,1, 100,100)
+ * vs.put(vob.vobs.RectBgVob(java.awt.Color.red), cs)
+ * def key(self, key):
+ * self.keyHit = 1 - self.keyHit
+ * self.windowAnimation.animate()
+ * </pre>
+ * </li><li>
+ * Example: When you want to pop a red box from left to right:
+ * <pre>
+ * class Scene:
+ * """ Example scene to pop red box from left to right
+ * and backwards.
+ * """
+ * def __init__(self, windowAnimation):
+ * self.windowAnimation = windowAnimation
+ * self.keyHit = 0
+ * self.left = 100
+ * self.right = 500
+ * def scene(self, vs):
+ * if self.keyHit == 0:
+ * cs = vs.orthoBoxCS(0, "RedBox", 0,self.left,
+ * 50, 1,1, 100,100)
+ * else:
+ * cs = vs.orthoBoxCS(0, "RedBox", 0,self.right,
+ * 50, 1,1, 100,100)
+ * vs.put(vob.vobs.RectBgVob(java.awt.Color.red), cs)
+ * def key(self, key):
+ * self.keyHit = 1 - self.keyHit
+ * self.windowAnimation.animate()
+ * </pre>
+ * </li><li>
+ * Example: Another way to pop a red box from left to right.
+ * This way is like ten times faster than creating a new scene:
+ * <pre>
+ * class Scene:
+ * """ Example scene to pop red box from left to right
+ * and backwards.
+ * """
+ * def __init__(self, windowAnimation):
+ * self.windowAnimation = windowAnimation
+ * self.keyHit = 0
+ * self.left = 100
+ * self.right = 500
+ * def scene(self, vs):
+ * if self.windowAnimation.getCurrentVS() != None: return
+ * cs = vs.orthoBoxCS(0, "RedBox", 0,self.left,
+ * 50, 1,1, 100,100)
+ * vs.put(vob.vobs.RectBgVob(java.awt.Color.red), cs)
+ * def key(self, key):
+ * self.keyHit = 1 - self.keyHit
+ *
+ * vs = self.windowAnimation.getCurrentVS()
+ * cs = vs.matcher.getCS(0, "RedBox")
+ * if self.keyHit == 0:
+ * vs.coords.setOrthoBoxParams(cs, 0,self.left,
+ * 50, 1,1, 100,100)
+ * else:
+ * vs.coords.setOrthoBoxParams(cs, 0,self.right,
+ * 50, 1,1, 100,100)
+ * self.windowAnimation.rerender()
+ * </li><li>
+ * Example: Quite a difficult example where we start to drag
+ * red box around the scene that may end to be yellow one.
+ * Point of the example is to use both rerendering of one
+ * scene and switching to scene.
+ *
+ * <pre>
+ * class Scene:
+ * """ Example scene to drag the red or yellow box around.
+ * In left the box is red but in right it is yellow.
+ * """
+ * def __init__(self, windowAnimation):
+ * self.windowAnimation = windowAnimation
+ * self.half = 300
+ * self.ev = None
+ * def scene(self, vs):
+ * # this is an event grabbing example.
+ * pass
+ * def mouse(self, ev):
+ * if self.ev = None: self.ev = ev
+ * vs = self.windowAnimation.getCurrentVS()
+ * if vs.matcher.getCS(0, "Box") < 1:
+ * cs = vs.orthoBoxCS(0, "Box", 0,ev.getX(),ev.getY(),
+ * 1,1, 100,100)
+ * if ev.getX() < self.half:
+ * vs.put(vob.vobs.RectBgVob(java.awt.Color.red), cs)
+ * else:
+ * vs.put(vob.vobs.RectBgVob(java.awt.Color.yellow), cs)
+ * cs = vs.matcher.getCS(0, "Box")
+ * if self.ev.getX() < self.half and ev.getX() < self.half:
+ * vs.coords.setOrthoBoxParams(cs, 0,ev.getX(),ev.getY(),
+ * 1,1, 100,100)
+ * if not self.windowAnimation.hasSceneReplacementPending():
+ * self.windowAnimation.rerender()
+ * elif self.ev.getX() > self.half and ev.getX() > self.half:
+ * vs.coords.setOrthoBoxParams(cs, 0,self.right,
+ * 50, 1,1, 100,100)
+ * if not self.windowAnimation.hasSceneReplacementPending():
+ * self.windowAnimation.rerender()
+ * else:
+ * self.windowAnimation.switchVS()
+ * self.ev = ev
+ * </li> </ol>
*/
public interface WindowAnimation {
@@ -178,32 +303,6 @@
*
* @see AbstractUpdateManager
* @see VobMatcher
- * <p>
- *
- * Example: When you want to interpolate a red box from rigth to left
- * you could do it, like:
- * <pre>
- * class Scene:
- * """ Example scene to animate red box from left to rigth
- * and backwards.
- * """
- * def __init__(self, animation):
- * self.anim = animation
- * self.keyHit = 0
- * self.left = 100
- * self.right = 500
- * def scene(self, vs):
- * if self.keyHit == 0:
- * cs = vs.orthoBoxCS(0, "RedBox", 0,self.left,
- * 50, 1,1, 100,100)
- * else:
- * cs = vs.orthoBoxCS(0, "RedBox", 0,self.right,
- * 50, 1,1, 100,100)
- * vs.put(vob.vobs.RectBgVob(java.awt.Color.red), cs)
- * def key(self, key):
- * self.keyHit = 1 - self.keyHit
- * self.anim.animate()
- * </pre>
*/
void animate();
@@ -257,7 +356,7 @@
* e.g., when waiting to move some new vob you
* you need to pass all events trough before the screen has updated.
*/
- boolean hasPendingVS();
+ boolean hasSceneReplacementPending();
}
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, (continued)
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/23
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/24
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/25
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/25
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst,
Matti Katila <=
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/26
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/26
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/26
- [ff-cvs] libvob/doc/pegboard/animation_api--mudyc peg.rst, Matti Katila, 2003/10/26