1. tween: {
  2. easeInQuad: function(pos){
  3. return Math.pow(pos, 2);
  4. },
  5.  
  6. easeOutQuad: function(pos){
  7. return -(Math.pow((pos-1), 2) -1);
  8. },
  9.  
  10. easeInOutQuad: function(pos){
  11. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,2);
  12. return -0.5 * ((pos-=2)*pos - 2);
  13. },
  14.  
  15. easeInCubic: function(pos){
  16. return Math.pow(pos, 3);
  17. },
  18.  
  19. easeOutCubic: function(pos){
  20. return (Math.pow((pos-1), 3) +1);
  21. },
  22.  
  23. easeInOutCubic: function(pos){
  24. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,3);
  25. return 0.5 * (Math.pow((pos-2),3) + 2);
  26. },
  27.  
  28. easeInQuart: function(pos){
  29. return Math.pow(pos, 4);
  30. },
  31.  
  32. easeOutQuart: function(pos){
  33. return -(Math.pow((pos-1), 4) -1)
  34. },
  35.  
  36. easeInOutQuart: function(pos){
  37. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,4);
  38. return -0.5 * ((pos-=2)*Math.pow(pos,3) - 2);
  39. },
  40.  
  41. easeInQuint: function(pos){
  42. return Math.pow(pos, 5);
  43. },
  44.  
  45. easeOutQuint: function(pos){
  46. return (Math.pow((pos-1), 5) +1);
  47. },
  48.  
  49. easeInOutQuint: function(pos){
  50. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,5);
  51. return 0.5 * (Math.pow((pos-2),5) + 2);
  52. },
  53.  
  54. easeInSine: function(pos){
  55. return -Math.cos(pos * (Math.PI/2)) + 1;
  56. },
  57.  
  58. easeOutSine: function(pos){
  59. return Math.sin(pos * (Math.PI/2));
  60. },
  61.  
  62. easeInOutSine: function(pos){
  63. return (-.5 * (Math.cos(Math.PI*pos) -1));
  64. },
  65.  
  66. easeInExpo: function(pos){
  67. return (pos==0) ? 0 : Math.pow(2, 10 * (pos - 1));
  68. },
  69.  
  70. easeOutExpo: function(pos){
  71. return (pos==1) ? 1 : -Math.pow(2, -10 * pos) + 1;
  72. },
  73.  
  74. easeInOutExpo: function(pos){
  75. if(pos==0) return 0;
  76. if(pos==1) return 1;
  77. if((pos/=0.5) < 1) return 0.5 * Math.pow(2,10 * (pos-1));
  78. return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
  79. },
  80.  
  81. easeInCirc: function(pos){
  82. return -(Math.sqrt(1 - (pos*pos)) - 1);
  83. },
  84.  
  85. easeOutCirc: function(pos){
  86. return Math.sqrt(1 - Math.pow((pos-1), 2))
  87. },
  88.  
  89. easeInOutCirc: function(pos){
  90. if((pos/=0.5) < 1) return -0.5 * (Math.sqrt(1 - pos*pos) - 1);
  91. return 0.5 * (Math.sqrt(1 - (pos-=2)*pos) + 1);
  92. },
  93.  
  94. easeOutBounce: function(pos){
  95. if ((pos) < (1/2.75)) {
  96. return (7.5625*pos*pos);
  97. } else if (pos < (2/2.75)) {
  98. return (7.5625*(pos-=(1.5/2.75))*pos + .75);
  99. } else if (pos < (2.5/2.75)) {
  100. return (7.5625*(pos-=(2.25/2.75))*pos + .9375);
  101. } else {
  102. return (7.5625*(pos-=(2.625/2.75))*pos + .984375);
  103. }
  104. },
  105.  
  106. easeInBack: function(pos){
  107. var s = 1.70158;
  108. return (pos)*pos*((s+1)*pos - s);
  109. },
  110.  
  111. easeOutBack: function(pos){
  112. var s = 1.70158;
  113. return (pos=pos-1)*pos*((s+1)*pos + s) + 1;
  114. },
  115.  
  116. easeInOutBack: function(pos){
  117. var s = 1.70158;
  118. if((pos/=0.5) < 1) return 0.5*(pos*pos*(((s*=(1.525))+1)*pos -s));
  119. return 0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos +s) +2);
  120. },
  121.  
  122. elastic: function(pos) {
  123. return -1 * Math.pow(4,-8*pos) * Math.sin((pos*6-1)*(2*Math.PI)/2) + 1;
  124. },
  125.  
  126. swingFromTo: function(pos) {
  127. var s = 1.70158;
  128. return ((pos/=0.5) < 1) ? 0.5*(pos*pos*(((s*=(1.525))+1)*pos - s)) :
  129. 0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos + s) + 2);
  130. },
  131.  
  132. swingFrom: function(pos) {
  133. var s = 1.70158;
  134. return pos*pos*((s+1)*pos - s);
  135. },
  136.  
  137. swingTo: function(pos) {
  138. var s = 1.70158;
  139. return (pos-=1)*pos*((s+1)*pos + s) + 1;
  140. },
  141.  
  142. bounce: function(pos) {
  143. if (pos < (1/2.75)) {
  144. return (7.5625*pos*pos);
  145. } else if (pos < (2/2.75)) {
  146. return (7.5625*(pos-=(1.5/2.75))*pos + .75);
  147. } else if (pos < (2.5/2.75)) {
  148. return (7.5625*(pos-=(2.25/2.75))*pos + .9375);
  149. } else {
  150. return (7.5625*(pos-=(2.625/2.75))*pos + .984375);
  151. }
  152. },
  153.  
  154. bouncePast: function(pos) {
  155. if (pos < (1/2.75)) {
  156. return (7.5625*pos*pos);
  157. } else if (pos < (2/2.75)) {
  158. return 2 - (7.5625*(pos-=(1.5/2.75))*pos + .75);
  159. } else if (pos < (2.5/2.75)) {
  160. return 2 - (7.5625*(pos-=(2.25/2.75))*pos + .9375);
  161. } else {
  162. return 2 - (7.5625*(pos-=(2.625/2.75))*pos + .984375);
  163. }
  164. },
  165.  
  166. easeFromTo: function(pos) {
  167. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,4);
  168. return -0.5 * ((pos-=2)*Math.pow(pos,3) - 2);
  169. },
  170.  
  171. easeFrom: function(pos) {
  172. return Math.pow(pos,4);
  173. },
  174.  
  175. easeTo: function(pos) {
  176. return Math.pow(pos,0.25);
  177. },
  178.  
  179. linear: function(pos) {
  180. return pos
  181. },
  182.  
  183. sinusoidal: function(pos) {
  184. return (-Math.cos(pos*Math.PI)/2) + 0.5;
  185. },
  186.  
  187. reverse: function(pos) {
  188. return 1 - pos;
  189. },
  190.  
  191. mirror: function(pos, transition) {
  192. transition = transition || tween.sinusoidal;
  193. if(pos<0.5)
  194. return transition(pos*2);
  195. else
  196. return transition(1-(pos-0.5)*2);
  197. },
  198.  
  199. flicker: function(pos) {
  200. var pos = pos + (Math.random()-0.5)/5;
  201. return tween.sinusoidal(pos < 0 ? 0 : pos > 1 ? 1 : pos);
  202. },
  203.  
  204. wobble: function(pos) {
  205. return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
  206. },
  207.  
  208. pulse: function(pos, pulses) {
  209. return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
  210. },
  211.  
  212. blink: function(pos, blinks) {
  213. return Math.round(pos*(blinks||5)) % 2;
  214. },
  215.  
  216. spring: function(pos) {
  217. return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
  218. },
  219.  
  220. none: function(pos){
  221. return 0
  222. },
  223.  
  224. full: function(pos){
  225. return 1
  226. }
  227. }

js缓动函数的更多相关文章

  1. JS —— 轮播图中的缓动函数的封装

    轮播图的根本其实就是缓动函数的封装,如果说轮播图是一辆跑动的汽车,那么缓动函数就是它的发动机,今天本文章就带大家由简入繁,封装属于自己的缓动函数~~ 我们从需求的角度开始,首先给出一个简单需求: 1. ...

  2. GSAP JS基础教程--使用缓动函数

    今天来了解一下缓动easeing函数. 开始,如果你还没有GSAP的类包,可以到GreenSock的官网去下载最新版本的类包,或者直接点击这里​来下载 学习之前,先来准备一下:     <!DO ...

  3. JS动画之缓动函数分析及动画库

    上一篇讲了JS动画定时器相关知识,这一篇介绍下缓动函数及流行的动画库. 熟悉的图 实际使用 jquery animate()+jquery.easing插件的使用: $(selector).anima ...

  4. tween.js缓动(补间动画)

    一.理解tween.js 如果看到上面的已经理解了,可以跳过下面的部分.下面为对Tween.js的解释 下面就介绍如何使用这个Tween了,首先b.c.d三个参数(即初始值,变化量,持续时间)在缓动开 ...

  5. NGUI缓动函数

    缓动函数:http://easings.net/zh-cn 研究NGUI的博客:http://dsqiu.iteye.com/category/295721

  6. iOS基本动画/关键帧动画/利用缓动函数实现物理动画效果

    先说下基本动画部分 基本动画部分比较简单, 但能实现的动画效果也很局限 使用方法大致为: #1. 创建原始UI或者画面 #2. 创建CABasicAnimation实例, 并设置keypart/dur ...

  7. Silverlight动画学习笔记(三):缓动函数

    (一)定义: 缓动函数:可以将自定义算术公式应用于动画 (二)为什么要用缓动函数: 您可能希望某一对象逼真地弹回或其行为像弹簧一样.您可以使用关键帧动画甚至 From/To/By 动画来大致模拟这些效 ...

  8. EaseType 缓动函数

    EaseType(动画曲线) EaseType 缓动函数或者我习惯叫它动画曲线,在很多的软件或动画中都有涉及到,下面是摘取的一些资料: 缓函数图例 Tween效果 每一幅图像当鼠标移上去,会有路径效果 ...

  9. 支持xcode6的缓动函数Easing以及使用示例

    支持xcode6的缓动函数Easing以及使用示例 用xcode6新建工程后,直接导致不支持之前的Easing缓动函数的代码,经过修改后就可以正常使用了,虽然比不上POP高大上的动画,但用缓动函数的动 ...

随机推荐

  1. C# Page基础功能,用于各页面继承

    IBasePage.cs文件 /// <summary> /// 用于页面或用户控件 /// </summary> public interface IBasePage { / ...

  2. ThinkPHP开发笔记-前后端数据交互

    此处就是 Controller 和 View 相互传数据. 1.Controller 向 View 的页面传数据.在控制器中把变量传递给模板,使用 assign 方法对模板变量赋值.例如: 在Cont ...

  3. 基于cornerstone.js的cornerstoneWADOImageLoader

    上一篇简单介绍了cornerstone.js的相关使用介绍和基于cornerstone的web库cornerstoneWADOImageLoader,在实际开发中遇到了相关的一些问题,在这里说明一下, ...

  4. 【Python】深入浅出学习Python的yield和generator

    背景 之前走马观花接触过Python协程的概念,这两天和一个同事聊到了协程,死活想不起来曾经看过的东西,就记得一个yield,概念不清: 所以想捋一捋相关的东西,此篇作为学习的记录. Generato ...

  5. 微信开发中使用curl忽略https证书

    http://blog.csdn.net/ljh504429906/article/details/51103519 微信开发中需要使用http及https的post与get请求实现api的调用.   ...

  6. 马哥教育python网络班19期 学习目标

    马哥教育python网络班19期 学习目标: (1)按群里的学习进度表,来自行学习,学完时间6个月. (2)学完后,薪资能达到20K+每月.

  7. 使用lock锁或Monitor.Enter的目的

    锁定的目的:由于多个线程 并行/并发 处理同一个“数据对象”(比如:在其它线程的某个地方发生了Clear.Add.Remove.Change等操作),导致“数据对象”不断变化,没法用了,所以,为了保证 ...

  8. C#多线程3种创建Thread、Delegate.BeginInvoke、线程池

    1   创建多线程,一般情况有以下几种:(1)通过Thread类   (2)通过Delegate.BeginInvoke方法   (3)线程池 using System; using System.C ...

  9. Ubuntu 下Python 环境问题

    问题描述: 原先使用Anaconda环境,若卸载后仍不能恢复到系统默认的Python环境. 解决方案: shell 寻找缓存路径,python的扩展/home/tom/anaconda/bin/pyt ...

  10. Post with HttpClient4

    转载:http://www.cnblogs.com/luxiaoxun/p/6165237.html 作者:阿凡卢 出处:http://www.cnblogs.com/luxiaoxun/ HttpC ...