zoukankan
html css js c++ java
WPF与缓动(三) 指数缓动
WPF与缓动(三) 指数缓动
周银辉
指数缓动给人的感觉是加速度很大.
它的原始公式来自:P(t) = Math.Pow(2, 10*(t-1));
与其他缓动一样,我在这里就直接给出其核心代码了:
//
指数缓动
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;
//
加速
//
return delta * Math.Pow(2, 10 * (value - 1)) + from;
//
减速
//
return delta * (-Math.Pow(2, -10 * value) + 1) + from;
//
先加速,后减速
double
t
=
value
*
this
.Duration.TimeSpan.Ticks;
double
d
=
this
.Duration.TimeSpan.Ticks;
if
((t
/=
(d
/
2
))
<
1
)
{
return
delta
/
2
*
Math.Pow(
2
,
10
*
(t
-
1
))
+
from;
}
return
delta
/
2
*
(
-
Math.Pow(
2
,
-
10
*
--
t)
+
2
)
+
from;
}
点击这里下载
源代码
查看全文
相关阅读:
Python实现决策树ID3算法
ML——决策树模型
Linux下用matplotlib画决策树
RedHat7.2安装matplotlib——之Python.h:没有那个文件或目录
没想到这么简单——滚雪球
pyspark中使用累加器Accumulator统计指标
pscp多线程传输文件
[笔记] 使用numpy手写k-means算法
[LeetCode in Python] 309 (M) best time to buy and sell stock with cooldown 最佳买卖股票时机含冷冻期
[LeetCode in Python] 75 (M) sort colors 颜色分类
原文地址:https://www.cnblogs.com/zhouyinhui/p/758897.html
最新文章
单例模式
python中Django 使用方法简述
Django中下划线的用法介绍(一)
JavaScript的基本操作(一)
JavaScript的作用域
破壳漏洞(CVE-2014-6271)分析
pwnable.kr-shellshock-witeup
PYG5.4第十六期第一轮基础六题
pwnable.kr-mistake-witeup
pwnable.kr-leg-witeup
热门文章
pwnable.kr-input-witeup
pwnable.kr-random-witeup
pwnable.kr-passcode-witeup
2.0版本中如何取得当前的控制器和方法
Yii2 ActiveForm组件的ajax提交
nginx反向代理后,重定向失败问题
Zabbix 4.0 安装配置
用PDFMiner从PDF中提取文本文字
朴素贝叶斯分类
Python实现决策树C4.5算法
Copyright © 2011-2022 走看看