Mercurial > MadButterfly
changeset 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 | 1d1f2a1e43f6 64c54ef39480 |
files | pyink/MBScene.py pyink/primitive_test.svg pyink/tween.py |
diffstat | 3 files changed, 65 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/pyink/MBScene.py Mon Dec 27 22:57:52 2010 +0800 +++ b/pyink/MBScene.py Mon Dec 27 23:01:48 2010 +0800 @@ -156,12 +156,10 @@ class MBScene(): _frameline_tween_types = (frameline.TWEEN_TYPE_NONE, - frameline.TWEEN_TYPE_MOVE, frameline.TWEEN_TYPE_SHAPE) _tween_obj_tween_types = (TweenObject.TWEEN_TYPE_NORMAL, - TweenObject.TWEEN_TYPE_RELOCATE, TweenObject.TWEEN_TYPE_SCALE) - _tween_type_names = ('normal', 'relocate', 'scale') + _tween_type_names = ('normal', 'scale') def __init__(self, desktop, win, root=None): self.desktop = desktop @@ -938,7 +936,7 @@ self.tweenTypeSelector = gtk.combo_box_new_text() self.tweenTypeSelector.append_text('normal') - self.tweenTypeSelector.append_text('relocate') + #self.tweenTypeSelector.append_text('relocate') self.tweenTypeSelector.append_text('scale') self.tweenTypeSelector.set_active(0) tweenbox.pack_start(self.tweenTypeSelector, expand=False,fill=False)
--- a/pyink/primitive_test.svg Mon Dec 27 22:57:52 2010 +0800 +++ b/pyink/primitive_test.svg Mon Dec 27 23:01:48 2010 +0800 @@ -26,17 +26,17 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.35" - inkscape:cx="375" - inkscape:cy="862.85714" + inkscape:zoom="0.7" + inkscape:cx="481.6562" + inkscape:cy="910.80426" inkscape:document-units="px" - inkscape:current-layer="Layer 1s1983" + inkscape:current-layer="Layer 1s6197" showgrid="false" - inkscape:window-width="778" - inkscape:window-height="639" - inkscape:window-x="512" - inkscape:window-y="118" - inkscape:window-maximized="0" /> + inkscape:window-width="1680" + inkscape:window-height="975" + inkscape:window-x="0" + inkscape:window-y="25" + inkscape:window-maximized="1" /> <metadata id="metadata7"> <rdf:RDF> @@ -51,12 +51,17 @@ <ns0:scenes> <ns0:scene start="1" + end="19" ref="Layer 1s1983" + type="scale" /> + <ns0:scene + start="1" end="19" + ref="Layer 1s1983" type="scale" /> <ns0:scene start="20" - ref="layer1s4140" + ref="Layer 1s6197" type="normal" /> </ns0:scenes> </metadata> @@ -93,53 +98,65 @@ id="rect3229" style="fill:#ff0000;fill-opacity:1" /> </g> + <rect + style="fill:#808000;fill-opacity:1" + id="rect3098" + width="57.142857" + height="61.42857" + x="21.428572" + y="153.79076" /> </g> <g - style="display:none" + style="" inkscape:groupmode="layer" - id="layer1s4140"> + id="Layer 1s6197" + ns0:duplicate-src="Layer 1s1983"> <g - id="g3083" - transform="translate(360,334.28571)"> + id="g3087" + ns0:duplicate-src="g3077" + transform="translate(265.71429,167.14286)"> <path sodipodi:type="arc" style="fill:#ff0000;fill-opacity:1" - id="path3085" + id="path3089" sodipodi:cx="102.85714" sodipodi:cy="168.07646" sodipodi:rx="42.857143" sodipodi:ry="47.142857" - d="m 145.71428,168.07646 c 0,26.03628 -19.18779,47.14286 -42.85714,47.14286 -23.669347,0 -42.857144,-21.10658 -42.857144,-47.14286 0,-26.03628 19.187797,-47.14285 42.857144,-47.14285 23.66935,0 42.85714,21.10657 42.85714,47.14285 z" - transform="translate(-48.571429,-100)" /> + d="m 145.71428,168.07646 a 42.857143,47.142857 0 1 1 -85.714284,0 42.857143,47.142857 0 1 1 85.714284,0 z" + transform="translate(-48.571429,-100)" + ns0:duplicate-src="path3237" /> </g> <g - id="g3087" - transform="translate(151.42857,191.42857)"> + id="g3091" + ns0:duplicate-src="g3072" + transform="translate(58.571429,51.428571)"> <rect style="fill:#ff0000;fill-opacity:1" - id="rect3089" + id="rect3093" width="25.714285" height="160" x="171.42537" y="-68.432068" - transform="matrix(0.8189798,0.57382236,-0.57382236,0.8189798,0,0)" /> + transform="matrix(0.8189798,0.57382236,-0.57382236,0.8189798,0,0)" + ns0:duplicate-src="rect3229" /> </g> </g> <g inkscape:label="dup" sodipodi:insensitive="1" - style="" - id="g3084"> + style="display:none" + id="g3086"> <g ref="g3077" - id="g3086" - transform="matrix(1,0,0,1,360,334.286)"> + id="g3088" + transform="matrix(1,0,0,1,225.857,142.071)"> <g - id="g3088"> + id="g3090"> <path sodipodi:type="arc" style="fill:#ff0000;fill-opacity:1" - id="path3090" + id="path3092" sodipodi:cx="102.85714" sodipodi:cy="168.07646" sodipodi:rx="42.857143" @@ -150,13 +167,13 @@ </g> <g ref="g3072" - id="g3092" - transform="matrix(1,0,0,1,151.429,191.429)"> + id="g3094" + transform="matrix(1,0,0,1,0,0)"> <g - id="g3094"> + id="g3096"> <rect style="fill:#ff0000;fill-opacity:1" - id="rect3096" + id="rect3099" width="25.714285" height="160" x="171.42537" @@ -164,6 +181,18 @@ transform="matrix(0.8189798,0.57382236,-0.57382236,0.8189798,0,0)" /> </g> </g> + <g + ref="rect3098" + id="g3101" + transform="matrix(1,0,0,1,0,0)"> + <rect + y="153.79076" + x="21.428572" + height="61.42857" + width="57.142857" + id="rect3103" + style="fill:#808000;fill-opacity:1" /> + </g> </g> </g> </svg>
--- 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: