Skip to content

Commit 0823b7a

Browse files
committed
add easing option
1 parent 45a5a9a commit 0823b7a

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ Jump.jump('.selector', {
126126

127127
##### easing
128128

129-
Easing function to be used for the transition.
129+
Easing function used to transition the `jump()`.
130130

131131
```es6
132132
Jump.jump('.selector', {
133133
easing: (t, b, c, d) => {
134-
return c * ( t /= d) * t + b
134+
return c * (t /= d) * t + b
135135
}
136136
})
137137
```

dist/jump.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jump.js",
3-
"version": "0.1.3",
3+
"version": "0.2.0",
44
"description": "A small, modern, dependency-free smooth scrolling library.",
55
"homepage": "https://github.com/callmecavs/jump.js",
66
"main": "dist/jump.min.js",

src/easing.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Robert Penner's easeInOutQuad - http://robertpenner.com/easing/
2+
3+
export default (t, b, c, d) => {
4+
t /= d / 2
5+
if(t < 1) return c / 2 * t * t + b
6+
t--
7+
return -c / 2 * (t * (t - 2) - 1) + b
8+
}

src/jump.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
const easeInOutQuad = (t, b, c, d) => {
2-
// Robert Penner's easeInOutQuad - http://robertpenner.com/easing/
3-
t /= d / 2
4-
if(t < 1) return c / 2 * t * t + b
5-
t--
6-
return -c / 2 * (t * (t - 2) - 1) + b
7-
}
1+
import easeInOutQuad from './easing'
82

93
export default class Jump {
104
jump(target, options = {}) {

0 commit comments

Comments
 (0)