Commit Graph

11 Commits

Author SHA1 Message Date
Frederic Junod
5906168bc0 Don't recompute delay every loop 2013-04-02 11:51:59 +02:00
Frederic Junod
e4a5744e06 Remove x,y params from ol.Kinetic.begin 2013-02-18 16:43:20 +01:00
Tim Schaub
440ea038fe Merge pull request #183 from tschaub/natural-names
More natural names for animations
2013-02-07 13:44:13 -08:00
Tim Schaub
a2bbdf7ccc More natural names for animations 2013-02-06 13:43:54 -07:00
Frederic Junod
2fea469037 Change ol.Kinetic.update arguments.
Instead of goog.events.BrowserEvent, accept a x,y pair.
2013-02-06 12:55:15 +01:00
Tom Payne
93976a5d9f Fix requires relating to recent commits 2013-01-30 23:47:13 +01:00
Bruno Binet
d2f30986db Set kinetic getDuration instance method to @private 2013-01-30 14:46:49 +01:00
Bruno Binet
dff8c2b2b2 Renaming to be more consistent with ol3 style
s/v_0/initialVelocity/
s/v_min/minVelocity/
2013-01-30 14:46:49 +01:00
Bruno Binet
d91e1d30d4 Get rid of binarySelect to find the first point. 2013-01-30 14:46:49 +01:00
Bruno Binet
79849888db Kinetic now returns directly the pre-render function
instead of returning the kinetic easing function only.

(thanks @fredj)
2013-01-29 15:34:11 +01:00
Bruno Binet
8a9738d755 Add support for kinetic effect while dragging.
Only dragpan interaction is supported for now.

The kinetic effect use the maths below (thx @twpayne):

Rate of decay (number, must be negative) = α
Minimum velocity (pixels/millisecond) = v_min
Initial velocity (pixels/millisecond) = v₀

Velocity at time t (pixels/millisecond) =
    α⋅t
v₀⋅ℯ

Distance travelled at time t (pixels) =
   ⎛ α⋅t    ⎞
v₀⋅⎝ℯ    - 1⎠
─────────────
      α

Duration of animation (milliseconds) =
   ⎛v_min⎞
log⎜─────⎟
   ⎝  v₀ ⎠
──────────
    α

Total distance travelled (pixels) =
-v₀ + v_min
───────────
     α

Easing function =
   ⎛ α⋅duration⋅t    ⎞
v₀⋅⎝ℯ             - 1⎠
──────────────────────
     -v₀ + v_min
2013-01-29 12:39:52 +01:00