def AnimateSpinningCircleEnter(self, curveSet, timeOffset): animations.FadeTo(self.wheelSpriteOuter, startVal=0.0, endVal=self.spinnerOpacity, duration=0.5, timeOffset=timeOffset) animations.FadeTo(self.wheelSpriteInner, startVal=0.0, endVal=self.spinnerOpacity, duration=0.5, timeOffset=timeOffset) animations.Tr2DRotateTo(self.wheelSpriteInner, startAngle=2 * math.pi, endAngle=0.0, loops=uiconst.ANIM_REPEAT, duration=60.0, curveType=uiconst.ANIM_LINEAR, curveSet=curveSet) animations.Tr2DRotateTo(self.wheelSpriteOuter, startAngle=0.0, endAngle=2 * math.pi, loops=uiconst.ANIM_REPEAT, duration=40.0, curveType=uiconst.ANIM_LINEAR, curveSet=curveSet)
def AnimateRadiatingCircles(self, curveSet, timeOffset=0.0): if self.isScrollEntry: return circleTimeOffset = 0.15 + timeOffset radiationCycleDuration = 0.5 self.radiatingTransform.display = True def CloseCircles(): self.radiatingTransform.display = False animations.Tr2DScaleTo(self.radiatingTransform, startScale=(0.2, 0.2), endScale=(1.5, 1.5), duration=radiationCycleDuration + timeOffset, curveSet=curveSet, timeOffset=timeOffset) animations.FadeTo(self.circle1, curveType=RADIATING_CIRCLE_OPACITY_CURVE_POINTS, duration=radiationCycleDuration, curveSet=curveSet, timeOffset=timeOffset) animations.FadeTo(self.circle2, curveType=RADIATING_CIRCLE_OPACITY_CURVE_POINTS, duration=radiationCycleDuration, curveSet=curveSet, timeOffset=circleTimeOffset, callback=CloseCircles)
def fade_out_active_image(self): if self.is_zoom_fixed: animations.FadeTo(self.zoom_image_sprite, startVal=1.0, endVal=0.5) self.image_sprite.SetAlpha(0) else: animations.FadeTo(self.image_sprite, startVal=1.0, endVal=0.5) self.hide_zoom_image()
def DoExitAnimation(self, callback=None): curveSet = None duration = 0.5 fadeOffset = 0.6 curveSet = animations.FadeTo(self.icon, duration=0.2, loops=3, startVal=self.iconOpacity, endVal=0.0, curveSet=curveSet) curveSet = animations.FadeTo(self.labelContainer, duration=0.2, loops=1, startVal=1.0, endVal=0.0, curveSet=curveSet, timeOffset=0.4) animations.FadeTo(self, startVal=self.opacity, endVal=0.0, duration=duration, curveSet=curveSet, timeOffset=fadeOffset) self.StopLabelUpdates() callback(duration + fadeOffset)
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 AnimAvailable(self): self.check.SetTexturePath(RES_AVAILABLE) animations.BlinkIn(self.check) animations.FadeTo(self.completedFill, startVal=self.completedFill.opacity, endVal=0.0) animations.FadeOut(self.timer, duration=0.3)
def AnimateEnableCenterIcon(self, curveSet): animations.FadeTo(self.icon, loops=4, duration=0.2, startVal=0.0, endVal=self.iconOpacity, curveType=uiconst.ANIM_LINEAR, curveSet=curveSet)
def UpdateLockedStatus(self): opacity = 0.6 if self.data.isLocked else 1.0 animations.FadeTo(self, startVal=self.opacity, endVal=opacity) if self.data.isLocked: self.CheckConstructLockIcon() animations.FadeIn(self.lockedIcon, duration=0.3) elif self.lockedIcon is not None: animations.FadeOut(self.lockedIcon, duration=0.3)
def AnimEntry(self): super(PurchaseSuccessPanel, self).AnimEntry() sm.GetService('audio').SendUIEvent(self.AUDIO_EVENT) animations.FadeIn(self.iconBackground, duration=0.5, timeOffset=self.TRANSITION_TIME) animations.FadeIn(self.iconForeground, duration=0.5, timeOffset=self.TRANSITION_TIME + 0.5) animations.Tr2DScaleTo(self.iconBackgroundTransform, startScale=(2.0, 2.0), endScale=(1.0, 1.0), duration=0.25, timeOffset=self.TRANSITION_TIME) animations.Tr2DScaleTo(self.iconForegroundTransform, startScale=(2.0, 2.0), endScale=(1.0, 1.0), duration=0.25, timeOffset=self.TRANSITION_TIME + 0.5) if hasattr(self, 'subTextCont'): animations.FadeTo(self.subTextCont, timeOffset=2)
def on_mouse_exit_main_image(self): animations.FadeTo(self.image_frame, duration=0.3, endVal=0.5, startVal=1.0) self.hide_mini_map() if not self.is_zoom_fixed: self.hide_zoom_image() self.show_main_image() uicore.uilib.SetCursor(uiconst.UICURSOR_POINTER)
def fix_post(self): animations.FadeTo(self.image_frame, duration=0.3, endVal=2.0, startVal=1.0, curveType=uiconst.ANIM_BOUNCE) self.is_zoom_fixed = not self.is_zoom_fixed if self.is_zoom_fixed: self.fade_in_lock() else: self.fade_in_unlock()
def SetActive(self, isActive): self.isActive = isActive if self.isActive: animations.FadeTo(self.icon, self.icon.opacity, self.opacityMouseDownIcon, duration=0.1) animations.FadeTo(self.label, self.label.opacity, self.opacityMouseDownLabel, duration=0.1) else: animations.FadeTo(self.icon, self.icon.opacity, self.opacityIdleIcon, duration=self.exitDuration) animations.FadeTo(self.label, self.label.opacity, self.opacityIdleLabel, duration=self.exitDuration) self.sensorSuite.SetSiteFilter(self.config.siteType, self.isActive)
def Update(self): self.gauge.SetValue(self.controller.progress) self.amountLabel.AnimSetAmount(self.controller.extractedPoints) opacity = 0.0 if self.controller.progress > 0.0 else 0.8 animations.FadeTo(self.noProgressHint, startVal=self.noProgressHint.opacity, endVal=opacity) target = 0.5 - self.controller.progress if self.controller.progress > 0.0 else 0.0 animations.MorphVector2(self.gaugeBG, 'translationPrimary', startVal=self.gaugeBG.translationPrimary, endVal=(target, 0.0))
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 TryFadeOutBracketAndReturnCurveSet(self, curveSet, points, siteData, totalDuration): try: locatorData = self.siteController.spaceLocations.GetBySiteID( siteData.siteID) curveSet = animations.FadeTo(locatorData.bracket, startVal=0.0, endVal=1.0, duration=totalDuration, curveType=points, curveSet=curveSet) except KeyError: pass return curveSet
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 Close(self, *args): TooltipPersistentPanel.Close(self, *args) if self.overlaps or self.overlapSites: for each in chain(self.overlaps, self.overlapSites): each.opacity = 1.0 each.pickState = uiconst.TR2_SPS_ON for layer in (uicore.layer.inflight, uicore.layer.sensorSuite): animations.FadeTo(layer, startVal=layer.opacity, endVal=1.0, duration=0.05) if self.sideContainer: self.sideContainer.Close()
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 AnimateFrameEnter(self, curveSet, timeOffset=0.0, callback=None): moveDist = 40 for index, (x, y) in enumerate(OUTER_BRACKET_ORIENTATIONS): sprite = self.outerSprites[index] curveSet = animations.MoveTo(sprite, startPos=((11 + moveDist) * x, (11 + moveDist) * y), endPos=(11 * x, 11 * y), duration=0.5, curveSet=curveSet, timeOffset=timeOffset) curveSet = animations.FadeTo( sprite, duration=0.8, curveType=OUTER_BRACKET_OPACITY_CURVE_POINTS, curveSet=curveSet, timeOffset=timeOffset, callback=callback)
def PrepareTooltipLoad(self, bracket): if uicore.uilib.leftbtn or uicore.uilib.rightbtn: return None currentPos = (uicore.uilib.x, uicore.uilib.y) lastPos = getattr(self, 'lastLoadPos', (None, None)) if lastPos == currentPos: return None self.lastLoadPos = currentPos self.tooltipBracket = bracket currentTooltip = uicore.uilib.tooltipHandler.GetPersistentTooltipByOwner( self) if currentTooltip and not (currentTooltip.destroyed or currentTooltip.beingDestroyed): if currentTooltip.IsOverlapBracket(bracket): return None currentTooltip.Close() isFloating = bracket.IsFloating() overlaps, boundingBox = GetOverlaps( bracket, useMousePosition=isinstance(bracket, SensorSuiteBracket), customBracketParent=uicore.layer.bracket) overlapSites = sm.GetService('sensorSuite').GetOverlappingSites() if isFloating and len(overlaps) + len(overlapSites) == 1: return None overlapSites.sort(key=lambda x: x.data.GetSortKey()) self.tooltipPositionRect = bracket.GetAbsolute() ro = bracket.renderObject self.bracketPosition = (ro.displayX, ro.displayY, ro.displayWidth, ro.displayHeight) for bracket in chain(overlaps, overlapSites): bracket.opacity = 2.0 for layer in (uicore.layer.inflight, uicore.layer.sensorSuite): animations.FadeTo(layer, startVal=layer.opacity, endVal=0.5, duration=0.5) uicore.uilib.tooltipHandler.LoadPersistentTooltip( self, loadArguments=(bracket, overlaps, boundingBox, overlapSites), customTooltipClass=PersistentInSpaceBracketTooltip, customPositionRect=boundingBox)
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)
def Collapse(self): animations.Tr2DRotateTo(self.arrow, endAngle=math.pi / 2.0, duration=0.15) reverseSortedEntries = reversed( sorted(self._entries, key=self._GetEntrySortKey)) for i, entry in enumerate(reverseSortedEntries): entry.Disable() animations.FadeTo(entry, startVal=1.0, endVal=0.0, duration=0.2, timeOffset=i * 0.02) animations.MoveTo( entry, startPos=(0, 0), endPos=(0, -(entry.height + entry.padTop + entry.padBottom)), duration=0.2, timeOffset=i * 0.02 + 0.1) sleepDuration = len(self._entries) * 0.02 + 0.3 blue.synchro.SleepWallclock(sleepDuration * 1000)
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 Expand(self): animations.Tr2DRotateTo(self.arrow, startAngle=math.pi / 2.0, endAngle=0.0, duration=0.15) sortedEntries = sorted(self._entries, key=self._GetEntrySortKey) for i, entry in enumerate(sortedEntries): entry.display = True animations.MoveTo( entry, startPos=(0, -(entry.height + entry.padTop + entry.padBottom)), endPos=(0, 0), duration=0.2, timeOffset=i * 0.02) animations.FadeTo(entry, startVal=0.0, endVal=1.0, duration=0.2, timeOffset=i * 0.02 + 0.1, callback=entry.Enable) sleepDuration = len(self._entries) * 0.02 + 0.3 blue.synchro.SleepWallclock(sleepDuration * 1000)
def OnSweepStarted(self, systemReadyTime, durationInSec, viewAngleInPlane, orderedDelayAndSiteList, sweepStartDelayMSec): logger.debug( 'OnSweepStarted readyTime=%s durationInSec=%s angle=%s sweepStartDelayMSec=%s', systemReadyTime, durationInSec, viewAngleInPlane, sweepStartDelayMSec) timeNow = blue.os.GetWallclockTime() timeSinceStartSec = float(timeNow - systemReadyTime) / SEC if timeSinceStartSec > sweepStartDelayMSec: logger.debug( 'OnSweepStarted too late. timeSinceStartSec=%s timeNow=%s', timeSinceStartSec, timeNow) self.UpdateVisibleSites() self.OnSweepEnded() return timeOffset = sweepStartDelayMSec - timeSinceStartSec self.UpdateVisibleSites() animations.FadeTo(self.sweepTransform, duration=durationInSec, startVal=0.0, endVal=0.0, curveType=((0.05, 1.0), (0.95, 1.0)), timeOffset=timeOffset) viewAngleInPlane += MATH_PI_2 animations.Tr2DRotateTo(self.sweepTransform, duration=durationInSec, startAngle=viewAngleInPlane, endAngle=viewAngleInPlane + MATH_2_PI, curveType=uiconst.ANIM_LINEAR, timeOffset=timeOffset) for delaySec, siteData in orderedDelayAndSiteList: indicator = self.siteIndicatorsBySiteID.get(siteData.siteID) if indicator: animations.FadeIn(indicator, duration=0.2, curveType=uiconst.ANIM_OVERSHOT, timeOffset=delaySec - timeSinceStartSec)
def animate_background(self): animations.FadeTo(self.gridBackground, duration=1, curveType=uiconst.ANIM_OVERSHOT5)
def AnimShow(self, delay=0.0): animations.FadeTo(self, duration=0.2, timeOffset=delay) animations.MoveInFromTop(self, curveType=uiconst.ANIM_OVERSHOT, duration=0.3, timeOffset=delay)
def _StartDeactivationAnimation(self): self.busy.display = True self.deactivationCurve = animations.FadeTo(self.busy, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.deactivationCurve)
def _StartActivationPendingAnimation(self): self.activationPendingCurve = animations.FadeTo( self.abilityIcon, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.activationPendingCurve)
def _StartActiveAnimation(self): self.glow.display = True self.activeCurve = animations.FadeTo(self.glow, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.activeCurve)