def UpdateUndoButton(self): self.CheckConstructUndoButton() if self.data.isExtracted: self.undoButton.Enable() animations.MorphScalar(self.undoButton, 'left', startVal=self.undoButton.left, endVal=4, duration=0.3) animations.MorphScalar(self.levelBar, 'left', startVal=self.levelBar.left, endVal=26, callback=self.UpdateLabelRightFade, duration=0.3) else: self.undoButton.Disable() animations.MorphScalar(self.undoButton, 'left', startVal=self.undoButton.left, endVal=-self.undoButton.width, duration=0.3) animations.MorphScalar(self.levelBar, 'left', startVal=self.levelBar.left, endVal=8, callback=self.UpdateLabelRightFade, duration=0.3)
def StartTimer(self, duration): if self.destroyed: return leftTimer, rightTimer = self._GetTimers() if leftTimer and rightTimer: durationInSec = duration / 1000 curveSet = animations.CreateCurveSet(useRealTime=False) if self.timeIncreases: curvePoints = ([0, math.pi], [0.5, 0], [1, 0]) else: curvePoints = ([0, 0], [0.5, -math.pi], [1, -math.pi]) animations.MorphScalar(rightTimer, 'rotationSecondary', duration=durationInSec, curveType=curvePoints, curveSet=curveSet) if self.timeIncreases: curvePoints = ([0, 0], [0.5, 0], [1, -math.pi]) else: curvePoints = ([0, math.pi], [0.5, math.pi], [1, 0]) animations.MorphScalar(leftTimer, 'rotationSecondary', duration=durationInSec, curveType=curvePoints, curveSet=curveSet) if self.blink: blinkIn = max(self.BLINK_MIN_DURATION, durationInSec - self.BLINK_MAX_DURATION) self.blinkTimer = AutoTimer(blinkIn * 1000, self._BlinkModule)
def UpdateKnob(self): if self.isEnabled: self.knob.StopAnimations() animations.MorphScalar(self.knob, 'left', startVal=self.knob.left, endVal=self.width / 2, duration=0.1) else: animations.MorphScalar(self.knob, 'left', startVal=self.knob.left, endVal=0, duration=0.1)
def EnterCompactMode(self): if self.compactMode: return self.compactMode = True animations.FadeOut(self.characters, duration=0.2) animations.MorphScalar(self.characters, 'left', startVal=self.characters.left, endVal=self.CHARACTERS_LEFT - 60, duration=0.3) animations.MorphScalar(self.content, 'left', startVal=self.content.left, endVal=0, duration=0.3)
def ExitCompactMode(self): if not self.compactMode: return self.compactMode = False animations.FadeIn(self.characters, duration=0.2) animations.MorphScalar(self.characters, 'left', startVal=self.characters.left, endVal=self.CHARACTERS_LEFT, duration=0.3) animations.MorphScalar(self.content, 'left', startVal=self.content.left, endVal=self.CONTENT_LEFT, duration=0.3)
def thread(): self.details = ContainerAutoSize(parent=self, align=uiconst.TOTOP, clipChildren=True) self.details.DisableAutoSize() EveLabelMedium(parent=self.details, align=uiconst.TOTOP, padding=(6, 3, 6, 2), text=self.quest.descriptionLabel) EveLabelMedium( parent=self.details, align=uiconst.TOTOP, padding=(6, 3, 6, 2), text=localization.GetByLabel('UI/Quest/RewardTitle')) EveLabelMedium(parent=self.details, align=uiconst.TOTOP, padding=(12, 6, 6, 12), text=self.quest.rewardLabel) _, height = self.details.GetAutoSize() animations.FadeIn(self.details, duration=0.3) animations.MorphScalar(self.details, 'height', startVal=self.details.height, endVal=height, duration=0.25, callback=self.details.EnableAutoSize)
def _AnimHideIconGlow(self): animations.FadeOut(self.iconGlow, duration=0.3) animations.MorphScalar(self.iconShadow, 'left', startVal=self.iconShadow.left, endVal=28, duration=0.2)
def OnQuestCompletedClient(self, quest): for entry in self.mainCont.children: try: entry.UpdateQuest(quest) except TypeError: pass swoop = Sprite( parent=self.topCont, align=uiconst.RELATIVE, top=0, rotation=-0.3, width=300, height=50, texturePath='res:/UI/Texture/classes/Animations/swoopGradient.png', opacity=0.3) animations.MorphScalar(swoop, 'left', startVal=-300, endVal=300, duration=1.2, callback=swoop.Close) animations.FadeTo(swoop, startVal=0.0, endVal=0.25, curveType=uiconst.ANIM_BOUNCE, duration=0.7, timeOffset=0.1)
def expand_screen(self): translationtop = (self.expandTopContainer.translation[0], -210) translationbottom = (self.expandBottomContainer.translation[0], -185) animations.MoveTo(self.expandTopContainer, startPos=(0, 0), endPos=translationtop, duration=0.2, curveType=uiconst.ANIM_LINEAR) animations.MoveTo(self.expandBottomContainer, startPos=(0, 0), endPos=translationbottom, duration=0.2, curveType=uiconst.ANIM_LINEAR) animations.MorphScalar(self, 'gradient_height', startVal=48, endVal=440, curveType=uiconst.ANIM_LINEAR, duration=0.2, callback=self.gradient_height_callback) sm.GetService('audio').SendUIEvent(const.Sounds.RewardsWindowOpenPlay)
def AnimSetAmount(self, amount): animations.MorphScalar( self, 'amount', startVal=self.amount, endVal=amount, callback=lambda: setattr(self, 'amount', amount))
def expand_screen(self): self.oldTranslationTop = self.expandTopContainer.translation self.oldTranslationBottom = self.expandBottomContainer.translation translationtop = (self.expandTopContainer.displayX, -self.images_container.displayHeight / 2.5) translationbottom = (self.expandBottomContainer.displayX, -self.images_container.displayHeight / 2.5) self.image_frame.SetRGB(0.498, 0.627, 0.74, 0.5) animations.MoveTo(self.expandTopContainer, startPos=(0, 0), endPos=translationtop, duration=0.3, curveType=uiconst.ANIM_LINEAR) animations.MoveTo(self.expandBottomContainer, startPos=(0, 0), endPos=translationbottom, duration=0.3, curveType=uiconst.ANIM_LINEAR) animations.MorphScalar(self, 'gradient_height', startVal=48, endVal=self.images_container.displayHeight, curveType=uiconst.ANIM_LINEAR, duration=0.3, callback=self.gradient_height_callback) self.audio_service.SendUIEvent(const.Sounds.AnalysisWindowMovePlay)
def start_percentage_count(self): animations.MorphScalar(self, 'percentage', startVal=self.percentage, endVal=100, curveType=uiconst.ANIM_SMOOTH, duration=2.5, callback=self.percentage_callback)
def _AnimShowIconGlow(self): self.iconGlow.opacity = 0.1 animations.SpMaskIn(self.iconGlow, duration=0.4) animations.MorphScalar(self.iconShadow, 'left', startVal=self.iconShadow.left, endVal=32, duration=0.2)
def AnimCollapse(self): animations.MorphScalar(self, 'width', startVal=self.width, endVal=ENTRY_DEFAULT_WIDTH, duration=0.1) animations.FadeOut(self.selectionGradient, duration=0.1) self._AnimHideIconGlow()
def _update_progress_bar(self, animate_progress = True): if not animate_progress: self.progress_gradient_fill.width = settings.char.ui.Get('season_progress_width', 0.0) return season_points = self.season_service.get_points() progress_width = self._calculate_progress_width_from_points(season_points) last_progress_width = self._get_last_progress_width(progress_width) self.progress_gradient_fill.width = last_progress_width self._set_last_progress_width(progress_width) animations.MorphScalar(self.progress_gradient_fill, 'width', last_progress_width, progress_width, duration=PROGRESS_BAR_ANIMATION_DURATION)
def OnBalanceChange(self, balance): def callback(): self.balance = balance animations.MorphScalar(self, 'balance', startVal=self.balance, endVal=balance, curveType=uiconst.ANIM_SMOOTH, duration=1.5, callback=callback)
def AnimExpand(self): animations.MorphScalar(self, 'width', startVal=self.width, endVal=ENTRY_EXPANDED_WIDTH, duration=0.15) animations.FadeIn(self.selectionGradient, endVal=0.4, duration=0.1, curveType=uiconst.ANIM_OVERSHOT) self._AnimShowIconGlow()
def update_progress_bar(self, new_progress): progress_width = self._calculate_progress_width(new_progress) self.progress_bar_container.width = progress_width - self.progress_frame_width_offset if progress_width > self.progress_frame_width_max - self.progress_frame_width_offset: new_width = self.progress_frame_width_max else: new_width = progress_width - self.progress_frame_width_offset if self.animate_progress: animations.MorphScalar(self.progress_frame_container, 'width', self.progress_frame_container.width, new_width, PROGRESS_BAR_UPDATE_ANIMATION_SPEED) return self.progress_frame_container.width = new_width
def continue_glowExpand(): animations.MorphScalar(icon, 'glowExpand', startVal=0.0, endVal=20.0, duration=0.5, curveType=uiconst.ANIM_SMOOTH) animations.SpColorMorphTo(icon, attrName='glowColor', startColor=(1.0, 1.0, 1.0, 0.5), endColor=(0.0, 0.0, 0.0, 0.0), duration=0.25, curveType=uiconst.ANIM_SMOOTH)
def RevealContainerContent(container): _, height = container.GetAutoSize() if height != container.height: animations.MorphScalar(container, 'height', startVal=container.height, endVal=height, duration=0.5, curveType=uiconst.ANIM_OVERSHOT) for background in container.background: if background.name == 'blinkSprite': background.Show() animations.SpSwoopBlink(background, rotation=math.pi * 0.75, duration=0.5) for child in container.children: animations.FadeIn(child, endVal=child.opacity or 1.0, duration=0.4) blue.synchro.SleepWallclock(500)
def AnimComplete(self): self.check.SetTexturePath(RES_COMPLETED) animations.BlinkIn(self.check) animations.MorphScalar(self.completedFill, 'displayWidth', startVal=0.0, endVal=self.displayWidth) animations.FadeTo(self.completedFill, startVal=1.5, endVal=0.5, duration=1.5, timeOffset=0.5) animations.FadeIn(self.timer, endVal=0.6, timeOffset=0.5)
def HideDetails(self): if not self.details or self.details.destroyed: return details = self.details self.details = None details.DisableAutoSize() animations.FadeOut(details, duration=0.15) animations.MorphScalar(details, 'height', startVal=details.height, endVal=0, duration=0.15, callback=details.Close)
def _animate_reward(self): self.animated_gradient_background = GradientSprite( name='animated_gradient_background', parent=self.reward_container, align=uiconst.TOALL, rgbData=ANIMATED_GRADIENT_BACKGROUND_RGD_DATA, alphaData=ANIMATED_GRADIENT_BACKGROUND_ALPHA_DATA, opacity=ANIMATED_GRADIENT_BACKGROUND_OPACITY) animations.MorphScalar(self.reward_container, 'width', endVal=self.width, duration=ANIMATED_GRADIENT_BACKGROUND_DURATION, timeOffset=ANIMATED_GRADIENT_BACKGROUND_OFFSET, callback=self._show_reward)
def AnimHide(self): for child in self.children: animations.FadeOut(child, duration=0.3) self.DisableAutoSize() animations.MorphScalar(self, 'height', startVal=self.height, endVal=0, timeOffset=0.1, duration=0.3) animations.MorphScalar(self, 'padTop', startVal=self.padTop, endVal=0, timeOffset=0.1, duration=0.3) animations.MorphScalar(self, 'padBottom', startVal=self.padBottom, endVal=0, timeOffset=0.1, duration=0.3)
def Animate(self): animations.FadeTo(self.iconGlow, startVal=1.0, endVal=0.4, duration=1.0, timeOffset=0.4, curveType=uiconst.ANIM_WAVE) animations.MorphScalar(self.iconGlare1, 'rectLeft', startVal=-150, endVal=200, duration=0.8, timeOffset=0.4) animations.MorphScalar(self.iconGlare2, 'rectTop', startVal=100, endVal=50, duration=1.2) animations.MorphScalar(self.iconGlare2, 'rectLeft', startVal=-60, endVal=20, duration=1.2)
def AnimShow(self): for child in self.children: animations.FadeIn(child, duration=0.3, timeOffset=0.1) self.EnableAutoSize() self.DisableAutoSize() animations.MorphScalar(self, 'height', startVal=0, endVal=self.height, duration=0.3) animations.MorphScalar(self, 'padTop', startVal=0, endVal=self.PAD_TOP, duration=0.3) animations.MorphScalar(self, 'padBottom', startVal=0, endVal=self.PAD_BOTTOM, duration=0.3, sleep=True) self.EnableAutoSize()
def _animate_icon(self): self.reward_item_icon_glow_container.width *= ANIMATED_ICON_SIZE_FACTOR self.reward_item_icon_glow_container.height *= ANIMATED_ICON_SIZE_FACTOR self.reward_item_icon_glow_container.Show() animations.MorphVector2(self.reward_item_icon_glow_container, 'scale', startVal=ANIMATED_ICON_SIZE_START_SCALE_SIZE, endVal=ANIMATED_ICON_SIZE_END_SCALE_SIZE, duration=ANIMATED_ICON_SIZE_DURATION) animations.MorphScalar(self.reward_item_icon_overlay_fill, 'opacity', startVal=ANIMATED_ICON_OVERLAY_OPACITY, endVal=ANIMATED_DEFAULT_OPACITY, duration=ANIMATED_ICON_OVERLAY_FILL_DURATION) self._animate_icon_glow()
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.label = EveLabelSmall(parent=self, text=attributes.text, bold=True, state=uiconst.UI_NORMAL, opacity=0.8) self.height = self.label.textheight self.width = self.label.textwidth animations.FadeTo(self, startVal=0.0, endVal=1.0, duration=0.1) animations.MorphScalar(self, 'displayWidth', 0, self.label.actualTextWidth, duration=0.2)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.markerObject = attributes.markerObject self.label = ExtraInfoLabel(parent=self, text=attributes.text, bold=True, state=uiconst.UI_NORMAL, opacity=0.8, cursor=uiconst.UICURSOR_POINTER) self.UpdateSize() Fill(bgParent=self, padding=(-3, 0, -2, 0), color=(0, 0, 0, 0.4)) animations.FadeTo(self, startVal=0.0, endVal=1.0, duration=0.1) animations.MorphScalar(self, 'displayWidth', 0, self.label.actualTextWidth, duration=0.2)
def _AnimShowStateIcon(self, icon): def continue_glowExpand(): animations.MorphScalar(icon, 'glowExpand', startVal=0.0, endVal=20.0, duration=0.5, curveType=uiconst.ANIM_SMOOTH) animations.SpColorMorphTo(icon, attrName='glowColor', startColor=(1.0, 1.0, 1.0, 0.5), endColor=(0.0, 0.0, 0.0, 0.0), duration=0.25, curveType=uiconst.ANIM_SMOOTH) animations.FadeIn(icon, duration=0.15, timeOffset=0.15) animations.SpColorMorphTo(icon, startColor=(0.0, 0.0, 0.0, 0.0), endColor=(1.0, 1.0, 1.0, 1.0), duration=0.15, timeOffset=0.2, curveType=uiconst.ANIM_SMOOTH) animations.SpColorMorphTo(icon, attrName='glowColor', startColor=(0.3, 0.3, 0.3, 0.0), endColor=(1.0, 1.0, 1.0, 0.5), duration=0.15, timeOffset=0.2, curveType=uiconst.ANIM_SMOOTH) animations.MorphScalar(icon, 'glowExpand', startVal=30.0, endVal=0.0, duration=0.2, timeOffset=0.15, curveType=uiconst.ANIM_SMOOTH, callback=continue_glowExpand) animations.FadeTo(self.stateIconLight, startVal=0.0, endVal=0.15, duration=0.55, timeOffset=0.15, curveType=uiconst.ANIM_BOUNCE)