zoukankan
html css js c++ java
WPF与缓动(四) 弧形缓动
WPF与缓动(四) 弧形缓动
周银辉
弧形缓动就是其缓动曲线为一段圆弧, 如何我们假设圆弧上的点的斜率为速度的话,那么可以想像其速度的变化多么具有戏剧性, 其加速或减速来得很突然, 与5次缓动差不多.
参考以下代码:
//
圆形缓动
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;
}
下载Demo
查看全文
相关阅读:
leetcode1078
leetcode417
我在机器学习踩过的坑,现在告诉你怎么跳过去
Python相关机器学习‘武器库’
分别列举人工智能4个主要领域中最牛叉的10位专家
多巴胺:谷歌开源新型增强学习框架
AI产品经理成长路
一个AI产品经理怎么看AI的发展
机器学习的数学基础
方差variance, 协方差covariance, 协方差矩阵covariance matrix
原文地址:https://www.cnblogs.com/zhouyinhui/p/762365.html
最新文章
springMVC validator验证的使用
spring @InitBinder
Spring + MyBaits java.lang.reflect.InvocationTargetException 启动日志报错
myeclipse中disable maven nature后如何找到恢复maven项目按钮
UML 图中类之间的关系:依赖,泛化,关联,聚合,组合,实现
eayui DataGrid 下拉框
easyUI Uncaught TypeError: Cannot read property 'length' of undefined
Python之matplotlib库
Python之operator库
Django之ORM模型
热门文章
Python之numpy库
django初探-创建简单的博客系统(二)
leetcode90
leetcode40
leetcode77
leetcode47
leetcode93
leetcode1079
leetcode1081
leetcode1080
Copyright © 2011-2022 走看看