]>
git.proxmox.com Git - sencha-touch.git/blob - src/src/fx/easing/Momentum.js
4 Ext
.define('Ext.fx.easing.Momentum', {
6 extend
: 'Ext.fx.easing.Abstract',
16 updateFriction: function(friction
) {
17 var theta
= Math
.log(1 - (friction
/ 10));
21 this.alpha
= theta
/ this.getAcceleration();
24 updateStartVelocity: function(velocity
) {
25 this.velocity
= velocity
* this.getAcceleration();
28 updateAcceleration: function(acceleration
) {
29 this.velocity
= this.getStartVelocity() * acceleration
;
31 this.alpha
= this.theta
/ acceleration
;
34 getValue: function() {
35 return this.getStartValue() - this.velocity
* (1 - this.getFrictionFactor()) / this.theta
;
38 getFrictionFactor: function() {
39 var deltaTime
= Ext
.Date
.now() - this.getStartTime();
41 return Math
.exp(deltaTime
* this.alpha
);
44 getVelocity: function() {
45 return this.getFrictionFactor() * this.velocity
;