comparison pyink/frameline.py @ 1164:2cb5047d8f2b

Add support to insert key frame in the middle of the tween.
author wycc
date Wed, 29 Dec 2010 00:33:48 +0800
parents c23593881507
children 96a7abce774a
comparison
equal deleted inserted replaced
1163:c23593881507 1164:2cb5047d8f2b
631 key_indic.sort() 631 key_indic.sort()
632 insert_pos = key_indic.index(idx) 632 insert_pos = key_indic.index(idx)
633 633
634 key = keyframe(idx) 634 key = keyframe(idx)
635 key.ref = ref 635 key.ref = ref
636 self._keys[insert_pos:insert_pos] = [key]
637 if insert_pos > 0 and self._keys[insert_pos - 1].right_tween: 636 if insert_pos > 0 and self._keys[insert_pos - 1].right_tween:
638 key.left_tween = True 637 if self._keys[insert_pos-1].idx == idx-1:
639 key.right_tween = True 638 self._keys[insert_pos-1].right_tween = False
640 key.right_tween_type = self._keys[insert_pos - 1].right_tween_type 639 self._keys[insert_pos:insert_pos] = [key]
641 pass 640 return
641 else:
642 key2 = keyframe(idx-1)
643 key2.ref = self._keys[insert_pos-1].ref
644 key2.left_tween = True
645 self._keys[insert_pos:insert_pos] = [key2,key]
646 key.left_tween = False
647 key.right_tween = True
648 key.right_tween_type = self._keys[insert_pos - 1].right_tween_type
649 pass
650 else:
651 self._keys[insert_pos:insert_pos] = [key]
642 652
643 if self._drawing: 653 if self._drawing:
644 self._draw_keyframe(idx) 654 self._draw_keyframe(idx)
645 pass 655 pass
646 pass 656 pass
657
658 ## Set the frame @idx as the right of a tween
659 def set_right_tween(self,idx):
660 pos = self._find_keyframe(idx)
661 self._keys[pos].right_tween = TRue
647 662
648 def rm_keyframe(self, idx): 663 def rm_keyframe(self, idx):
649 key_pos = self._find_keyframe(idx) 664 key_pos = self._find_keyframe(idx)
650 key = self._keys[key_pos] 665 key = self._keys[key_pos]
651 del self._keys[key_pos] 666 del self._keys[key_pos]