WPF and easing (quad) arc easing

Source: Internet
Author: User

The arc easing is its easing curve for a circle of arcs, how we assume the slope of the point on the arc as the speed, then you can imagine the change in the speed of how dramatic, its acceleration or deceleration came very suddenly, and 5 times the ease of the same.

Refer to the following code:

//圆形缓动
protected override double GetCurrentValueCore(double defaultOriginValue, double defaultDestinationValue, AnimationClock animationClock)
{
double from = (this.From==null?defaultDestinationValue:(double)this.From);
double to = (this.To==null?defaultOriginValue:(double)this.To);
double delta = to - from;
double value = animationClock.CurrentProgress.Value;

double t = value * this.Duration.TimeSpan.Ticks;
double d = this.Duration.TimeSpan.Ticks;

//加速
//return delta * (1-Math.Sqrt(1-(t/=d)*t)) + from;

//减速
//return delta * Math.Sqrt(1 - (t = t / d - 1) * t) + from;

//先加速,后减速
if ((t /= (d / 2)) < 1)
{
return delta / 2 * (1 - Math.Sqrt(1 - t * t)) + from;
}
return delta / 2 * (Math.Sqrt(1 - (t -= 2) * t) + 1) + from;

}

This article supporting source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.