def commit(self): add_time = CACurrentMediaTime() target_map = {} anim_map = {} slayer_time = self.baseLayer.convertTime_fromLayer_(add_time, None) total_time = 0.0 c_begin = slayer_time latest_end_time = c_begin for anim in self.animations: if anim.label and not anim.isWaitMark: anim_map[anim.label] = anim if anim.cs_input: if not anim.cs_input in target_map: target_map[anim.cs_input] = {'c_begin': c_begin, 'latest_end_time':0} use_begin = slayer_time if anim.isWaitMark: tmp_begin = c_begin use_end = latest_end_time if anim.cs_input: tmp_begin = target_map[anim.cs_input]['c_begin'] use_end = target_map[anim.cs_input]['latest_end_time'] if anim.label and anim.label in anim_map: label_anim = anim_map[anim.label] use_end = label_anim.end_time if anim.isWaitOnly: tmp_begin += anim.duration else: tmp_begin = use_end tmp_begin += anim.duration if anim.cs_input: target_map[anim.cs_input]['c_begin'] = tmp_begin else: c_begin = tmp_begin if not anim.ignore_wait and anim.animation: anim.animation.setValue_forKeyPath_(anim, "__CS_COMPLETION__") anim.animation.setDelegate_(CSAnimationDelegate.alloc().init()) real_begin = c_begin if anim.cs_input: t_begin = target_map[anim.cs_input]['c_begin'] if real_begin > t_begin: target_map[anim.cs_input]['c_begin'] = real_begin else: real_begin = t_begin a_duration = anim.apply(real_begin) if not anim.ignore_wait: latest_end_time = max(latest_end_time, real_begin+anim.duration) if anim.cs_input: t_latest = target_map[anim.cs_input]['latest_end_time'] n_latest = real_begin+anim.duration target_map[anim.cs_input]['latest_end_time'] = max(t_latest, n_latest) CATransaction.commit()
def apply_immediate(self): if self.target: p_value = self.toValue CATransaction.begin() #CATransaction.setDisableActions_(True) self.target.setValue_forKeyPath_(p_value, self.animation.keyPath()) if self.extra_model: self.extra_model.setValue_forKeyPath_(p_value, self.animation.keyPath()) CATransaction.commit()
def apply_immediate(self): if self.target: p_value = self.toValue CATransaction.begin() #CATransaction.setDisableActions_(True) self.target.setValue_forKeyPath_(p_value, self.animation.keyPath()) if self.extra_model: self.extra_model.setValue_forKeyPath_(p_value, self.animation.keyPath()) CATransaction.commit()
def set_model_value(self, realme=None): if self.target: p_layer = self.target.presentationLayer() if not p_layer: return p_value = p_layer.valueForKeyPath_(self.animation.keyPath()) CATransaction.begin() CATransaction.setDisableActions_(True) self.target.setValue_forKeyPath_(p_value, self.animation.keyPath()) if self.extra_model: self.extra_model.setValue_forKeyPath_(p_value, self.animation.keyPath()) self.target.removeAnimationForKey_(self.uukey) CATransaction.commit()
def set_model_value(self, realme=None): if self.target: p_layer = self.target.presentationLayer() if not p_layer: return p_value = p_layer.valueForKeyPath_(self.animation.keyPath()) CATransaction.begin() CATransaction.setDisableActions_(True) self.target.setValue_forKeyPath_(p_value, self.animation.keyPath()) if self.extra_model: self.extra_model.setValue_forKeyPath_(p_value, self.animation.keyPath()) self.target.removeAnimationForKey_(self.uukey) CATransaction.commit()
def commit(self): add_time = CACurrentMediaTime() target_map = {} anim_map = {} slayer_time = self.baseLayer.convertTime_fromLayer_(add_time, None) total_time = 0.0 c_begin = slayer_time latest_end_time = c_begin for anim in self.animations: if anim.label and not anim.isWaitMark: anim_map[anim.label] = anim if anim.cs_input: if not anim.cs_input in target_map: target_map[anim.cs_input] = { 'c_begin': c_begin, 'latest_end_time': 0 } use_begin = slayer_time if anim.isWaitMark: tmp_begin = c_begin use_end = latest_end_time if anim.cs_input: tmp_begin = target_map[anim.cs_input]['c_begin'] use_end = target_map[anim.cs_input]['latest_end_time'] if anim.label and anim.label in anim_map: label_anim = anim_map[anim.label] use_end = label_anim.end_time if anim.isWaitOnly: tmp_begin += anim.duration else: tmp_begin = use_end tmp_begin += anim.duration if anim.cs_input: target_map[anim.cs_input]['c_begin'] = tmp_begin else: c_begin = tmp_begin if not anim.ignore_wait and anim.animation: anim.animation.setValue_forKeyPath_(anim, "__CS_COMPLETION__") anim.animation.setDelegate_(CSAnimationDelegate.alloc().init()) real_begin = c_begin if anim.cs_input: t_begin = target_map[anim.cs_input]['c_begin'] if real_begin > t_begin: target_map[anim.cs_input]['c_begin'] = real_begin else: real_begin = t_begin a_duration = anim.apply(real_begin) if not anim.ignore_wait: latest_end_time = max(latest_end_time, real_begin + anim.duration) if anim.cs_input: t_latest = target_map[anim.cs_input]['latest_end_time'] n_latest = real_begin + anim.duration target_map[anim.cs_input]['latest_end_time'] = max( t_latest, n_latest) CATransaction.commit()