comparison pyink/tween.py @ 1360:f89d3ee130de

Remove TweenObject._update_tween_style
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 16 Feb 2011 15:11:38 +0800
parents 5313bbfafa67
children
comparison
equal deleted inserted replaced
1359:5313bbfafa67 1360:f89d3ee130de
447 if newobj == None: 447 if newobj == None:
448 newobj = s.duplicate(self._doc) 448 newobj = s.duplicate(self._doc)
449 newobj.setAttribute("ref", s.getAttribute("id")) 449 newobj.setAttribute("ref", s.getAttribute("id"))
450 obj.appendChild(newobj) 450 obj.appendChild(newobj)
451 pass 451 pass
452 self.update_tween_object_scale(s, d, p, newobj) 452 self._update_tween_object_scale(s, d, p, newobj)
453 pass 453 pass
454 elif typ == self.TWEEN_TYPE_NORMAL and newobj == None: 454 elif typ == self.TWEEN_TYPE_NORMAL and newobj == None:
455 newobj = s.duplicate(self._doc) 455 newobj = s.duplicate(self._doc)
456 newobj.setAttribute("ref", s.getAttribute("id")) 456 newobj.setAttribute("ref", s.getAttribute("id"))
457 obj.appendChild(newobj) 457 obj.appendChild(newobj)
458 pass 458 pass
459 pass 459 pass
460 460
461 def _update_tween_style(self, s, d, p, newobj): 461 def _update_tween_object_scale(self, start, stop, percent, newobj):
462 if d.name() == 'svg:use':
463 return
464 try:
465 s_style = s.getAttribute('style')
466 except:
467 s_attrs = {}
468 else:
469 s_attrs = _parse_style(s_style)
470 pass
471
472 try:
473 d_style = d.getAttribute('style')
474 except:
475 d_attrs = {}
476 else:
477 d_attrs = _parse_style(d_style)
478 pass
479
480 attrs = dict(s_attrs)
481
482 if s_attrs.has_key('opacity'):
483 start_opacity = float(s_attrs['opacity'])
484 else:
485 start_opacity = 1
486 pass
487
488 if d_attrs.has_key('opacity'):
489 end_opacity = float(d_attrs['opacity'])
490 else:
491 end_opacity = 1
492 pass
493
494 cur_opacity = start_opacity * (1 - p) + end_opacity * p
495 attrs['opacity'] = '%g' % (cur_opacity)
496
497 new_style = _gen_style(attrs)
498 newobj.setAttribute('style', new_style)
499 pass
500
501 def update_tween_object_scale(self, start, stop, percent, newobj):
502 start_attrs = {} 462 start_attrs = {}
503 _parse_style_ani(start, start_attrs) 463 _parse_style_ani(start, start_attrs)
504 _parse_attr_ani(start, start_attrs) 464 _parse_attr_ani(start, start_attrs)
505 465
506 stop_attrs = {} 466 stop_attrs = {}