Skip to content

Commit be44408

Browse files
committed
feat (js) : update oneloop to version 5
1 parent b40a740 commit be44408

File tree

5 files changed

+2725
-1371
lines changed

5 files changed

+2725
-1371
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"license": "GPL-2.0",
1616
"dependencies": {
1717
"lazysizes": "^5.3.2",
18-
"oneloop.js": "^4.0.0",
18+
"oneloop.js": "^5.0.0",
1919
"what-input": "^5.2.10"
2020
},
2121
"devDependencies": {

src/js/classes/Animation.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class Animation extends AbstractDomElement {
4646

4747
// add element to scrollObserver
4848
scrollObserver.observe(el, {
49-
onVisible: function (scrollInfos, percentRTE) {
50-
if (percentRTE >= start && percentRTE <= end && !that._isVisible) {
49+
onVisible: function (scrollInfos, percentRTW, percentRTE) {
50+
if (percentRTE.y >= start && percentRTE.y <= end && !that._isVisible) {
5151
// show element
5252
that._isVisible = true
5353
s.onShow(el, scrollInfos, callbacksSharedData)
@@ -57,7 +57,7 @@ class Animation extends AbstractDomElement {
5757
if (s.playOnce) {
5858
that.destroy(el, scrollInfos, callbacksSharedData)
5959
}
60-
} else if ((percentRTE < start || (percentRTE > end && s.hideOnReachEnd)) && that._isVisible) {
60+
} else if ((percentRTE.y < start || (percentRTE.y > end && s.hideOnReachEnd)) && that._isVisible) {
6161
// hide element
6262
that._isVisible = false
6363
s.onHide(el, scrollInfos, callbacksSharedData)
@@ -162,10 +162,10 @@ Animation.preset = {
162162
el.children[0].style.transitionDuration = Math.random() * 0.75 + 0.75 + 's'
163163
},
164164
onShow: function (el, scrollInfos, data) {
165-
el.children[0].style.transform = 'translateY(' + scrollInfos.directionY * data.translate + 'px)'
165+
el.children[0].style.transform = 'translateY(' + scrollInfos.direction.y * data.translate + 'px)'
166166
},
167167
onHide: function (el, scrollInfos, data) {
168-
el.children[0].style.transform = 'translateY(' + scrollInfos.directionY * data.translate + 'px)'
168+
el.children[0].style.transform = 'translateY(' + scrollInfos.direction.y * data.translate + 'px)'
169169
},
170170
},
171171
'.js-animation .js-animation-title': {

src/js/classes/ScrollDirection.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ class ScrollDirection extends AbstractDomElement {
1919
this._timer = null
2020

2121
this._scrollObserver.observe(this._element, {
22-
onAlways: function (scroll, percent, percent2) {
23-
const p = Math.min(Math.round(percent2 * 100), 100)
22+
onAlways: function (scroll, percentRTW, percentRTE) {
23+
const p = Math.min(Math.round(percentRTE.y * 100), 100)
2424

2525
if (p === 0) {
2626
that.set('top')
2727
} else if (p === 100) {
2828
that.set('bottom')
29-
} else if (scroll.directionY === -1) {
29+
} else if (scroll.direction.y === -1) {
3030
that.set('up')
31-
} else if (scroll.directionY === 1) {
31+
} else if (scroll.direction.y === 1) {
3232
that.set('down')
3333
}
3434
},

src/scss/04-utilities/_js-animation.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
%js-animation-translation-init {
4040
> * {
4141
opacity: 0;
42-
transition: opacity .5s, transform .5s $ease-in-out-expo;
42+
transition: opacity .5s, transform .5s $ease-out-expo;
4343
transform: translateY(100px);
4444
}
4545
}

0 commit comments

Comments
 (0)