protected override void Update() { base.Update(); // the point at which alpha is saturated and we begin to adjust colour lightness. const float lighten_cutoff = 0.95f; // the amount of lightness to attribute regardless of relative value to peak point. const float non_relative_portion = 0.2f; float amount = 0; // give some amount of alpha regardless of relative count amount += non_relative_portion * Math.Min(1, count / 10f); // add relative portion amount += (1 - non_relative_portion) * (count / heatmap.PeakValue); // apply easing amount = (float)Interpolation.ApplyEasing(Easing.OutQuint, Math.Min(1, amount)); Debug.Assert(amount <= 1); Alpha = Math.Min(amount / lighten_cutoff, 1); if (pointType == HitPointType.Hit) { Colour = BaseColour.Lighten(Math.Max(0, amount - lighten_cutoff)); } }
protected virtual void UpdateState() { float targetWidth = Active.Value ? EXPANDED_SWITCH_WIDTH : IDLE_SWITCH_WIDTH; double transitionDuration = TRANSITION_DURATION; Colour4 textBackgroundColour = Active.Value ? activeColour : (Colour4)ColourProvider.Background2; Colour4 mainBackgroundColour = Active.Value ? activeColour.Darken(0.3f) : (Colour4)ColourProvider.Background3; Colour4 textColour = Active.Value ? (Colour4)ColourProvider.Background6 : Colour4.White; // Hover affects colour of button background if (IsHovered) { textBackgroundColour = textBackgroundColour.Lighten(0.1f); mainBackgroundColour = mainBackgroundColour.Lighten(0.1f); } // Mouse down adds a halfway tween of the movement if (mouseDown) { targetWidth = (float)Interpolation.Lerp(IDLE_SWITCH_WIDTH, EXPANDED_SWITCH_WIDTH, 0.5f); transitionDuration *= 4; } Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(mainBackgroundColour, textBackgroundColour), transitionDuration, Easing.OutQuint); Background.FadeColour(mainBackgroundColour, transitionDuration, Easing.OutQuint); SwitchContainer.ResizeWidthTo(targetWidth, transitionDuration, Easing.OutQuint); MainContentContainer.TransformTo(nameof(Padding), new MarginPadding { Left = targetWidth, Right = CORNER_RADIUS }, transitionDuration, Easing.OutQuint); TextBackground.FadeColour(textBackgroundColour, transitionDuration, Easing.OutQuint); TextFlow.FadeColour(textColour, transitionDuration, Easing.OutQuint); }
/// <summary> /// Updates the state of the circular control point marker. /// </summary> private void updateMarkerDisplay() { Position = slider.StackedPosition + ControlPoint.Position; markerRing.Alpha = IsSelected.Value ? 1 : 0; Colour4 colour = getColourFromNodeType(); if (IsHovered || IsSelected.Value) { colour = colour.Lighten(1); } marker.Colour = colour; marker.Scale = new Vector2(slider.Scale); }
protected void ReleaseStars(int count) { sparklePool.Clock = Clock; while (count-- > 0) { var sparkle = sparklePool.Borrow(duration: 300); sparkle.Colour = colour.Lighten(0.3f); sparkle.Size = new Vector2(20); sparkle.gravity = new Vector2(0, 2000); sparkle.velocity = new Vector2(starRandomizer.Next(-300, 300), starRandomizer.Next(-500, 200)); sparkle.angularVelocity = starRandomizer.Next(-200, 200); Playfield.SFX.Add(sparkle); sparkle.Position = ToSpaceOfOtherDrawable(Vector2.Zero, Playfield) - Playfield.LayoutSize / 2; } }
private void load(OsuColour colours) { defaultBackgroundColour = colours.Gray3; defaultBubbleColour = defaultBackgroundColour.Darken(0.5f); selectedBackgroundColour = colours.BlueDark; selectedBubbleColour = selectedBackgroundColour.Lighten(0.5f); Content.EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 2, Offset = new Vector2(0, 1), Colour = Colour4.Black.Opacity(0.5f) }; Add(icon = (Button.CreateIcon?.Invoke() ?? new Circle()).With(b => { b.Blending = BlendingParameters.Additive; b.Anchor = Anchor.CentreLeft; b.Origin = Anchor.CentreLeft; b.Size = new Vector2(20); b.X = 10; })); }