diff pyink/tween.py @ 1157:3a891dccabd8

Remove the locate tween. It is a special case for the scale tween
author wycc
date Mon, 27 Dec 2010 23:01:48 +0800
parents ad9c44a08645
children 1a699dc00fa3
line wrap: on
line diff
--- a/pyink/tween.py	Mon Dec 27 22:57:52 2010 +0800
+++ b/pyink/tween.py	Mon Dec 27 23:01:48 2010 +0800
@@ -5,8 +5,8 @@
 
 class TweenObject:
     TWEEN_TYPE_NORMAL = 0
-    TWEEN_TYPE_RELOCATE = 1
-    TWEEN_TYPE_SCALE = 2
+    #TWEEN_TYPE_RELOCATE = 1
+    TWEEN_TYPE_SCALE = 1
 
     def __init__(self,doc,dom):
         self.document = doc
@@ -164,43 +164,7 @@
 	    Generate tweened object in the @obj by using s and d in the @p percent
 	    http://lists.w3.org/Archives/Public/www-style/2010Jun/0602.html
 	"""
-	if typ == self.TWEEN_TYPE_RELOCATE:
-	    if s.name() == 'svg:g':
-		if not newobj:
-		    newobj = s.duplicate(self.document)
-		    top = self.document.createElement("svg:g")
-		    top.setAttribute("ref", s.getAttribute("id"))
-		    top.appendChild(newobj)
-		    obj.appendChild(top)
-		else:
-		    top = newobj
-		    pass
-		# Parse the translate or matrix
-		sm = self.parseTransform(s)
-		dm = self.parseTransform(d)
-		top.setAttribute("transform","translate(%g,%g)" % ((dm[2]-sm[2])*p,(dm[5]-sm[5])*p))
-	    else:
-		if not newobj:
-		    top = s.duplicate(self.document)
-		    top.setAttribute('ref', s.getAttribute('id'))
-		    obj.appendChild(top)
-		else:
-		    top = newobj
-		    pass
-		try:
-		    sx = float(s.getAttribute("x"))
-		    sy = float(s.getAttribute("y"))
-		    dx = float(d.getAttribute("x"))
-		    dy = float(d.getAttribute("y"))
-		    tx = (dx-sx)*p
-		    ty = (dy-sy)*p
-		    print tx,ty
-		    top.setAttribute("transform","translate(%g,%g)" % (tx,ty))
-		except:
-		    traceback.print_exc()
-		    pass
-	    pass
-	elif typ == self.TWEEN_TYPE_SCALE:
+	if typ == self.TWEEN_TYPE_SCALE:
 	    self.updateTweenObjectScale(obj,s,d,p,newobj)
 	    pass
 	elif typ == self.TWEEN_TYPE_NORMAL: