Refactoring easing

This commit is contained in:
LarsBrubaker 2018-04-12 07:16:58 -07:00
parent 8a1fde6d72
commit 0c8b32f0d5
4 changed files with 8 additions and 5 deletions

View file

@ -37,6 +37,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using static MatterHackers.Agg.Easing;
namespace MatterHackers.MatterControl
{
@ -96,7 +97,7 @@ namespace MatterHackers.MatterControl
time = 1 - (time - 1);
}
double lightnessMultiplier = agg_basics.EaseInOutQuad(time);
double lightnessMultiplier = Quadratic.InOut(time);
widgetToHighlight.BackgroundColor = startColor.AdjustLightness(1 + lightnessChange * lightnessMultiplier).ToColor();
if (widgetToHighlight.HasBeenClosed || timeSinceStart.Elapsed.TotalSeconds > cycles * pulseTime)

View file

@ -34,6 +34,7 @@ using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.VectorMath;
using static MatterHackers.Agg.Easing;
namespace MatterHackers.MatterControl.CustomWidgets
{
@ -122,7 +123,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
Color toggleColor = (this.Checked) ? theme.Colors.PrimaryAccentColor : Color.Gray;
e.Graphics2D.Circle(position,
finalRadius * agg_basics.EaseOutQuartic(animationRatio),
finalRadius * Quadratic.Out(animationRatio),
new Color(toggleColor, 100));
}

View file

@ -45,6 +45,7 @@ using MatterHackers.RayTracer;
using MatterHackers.RenderOpenGl;
using MatterHackers.RenderOpenGl.OpenGl;
using MatterHackers.VectorMath;
using static MatterHackers.Agg.Easing;
namespace MatterHackers.MeshVisualizer
{
@ -525,11 +526,11 @@ namespace MatterHackers.MeshVisualizer
var accentColor = Color.LightGray;
if (secondsSinceSelectionChanged < .25)
{
selectionColor = Color.White.Blend(accentColor, agg_basics.EaseInOutQuad(secondsSinceSelectionChanged * 4));
selectionColor = Color.White.Blend(accentColor, Quadratic.InOut(secondsSinceSelectionChanged * 4));
}
else
{
selectionColor = accentColor.Blend(Color.White, agg_basics.EaseInOutQuad((secondsSinceSelectionChanged - .25) * 4));
selectionColor = accentColor.Blend(Color.White, Quadratic.InOut((secondsSinceSelectionChanged - .25) * 4));
}
Invalidate();
}

@ -1 +1 @@
Subproject commit af88c2020bde9ba76fc369ec105ac480b1cb2c25
Subproject commit a9e3428ee5ae4e21362ba4d4130d29a86daba5dc