Footer: Animation depend on the direction.
This commit is contained in:
parent
a68ba0aa74
commit
870b6dbdfb
1 changed files with 4 additions and 3 deletions
|
@ -14,17 +14,18 @@
|
||||||
|
|
||||||
function slideText(event) {
|
function slideText(event) {
|
||||||
const id = event.detail.id;
|
const id = event.detail.id;
|
||||||
const width = window.innerWidth;
|
const width = window.innerWidth/2;
|
||||||
|
const animTranslate = active > id ? [width, -width] : [-width, width];
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: pageDiv,
|
targets: pageDiv,
|
||||||
translateX: width / 2,
|
translateX: animTranslate[0],
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
easing: 'easeInQuad',
|
easing: 'easeInQuad',
|
||||||
complete: function () {
|
complete: function () {
|
||||||
active = id;
|
active = id;
|
||||||
pageDiv.style.transform = `translateX(-${width}px)`;
|
pageDiv.style.transform = `translateX(${animTranslate[1]}px)`;
|
||||||
anime({
|
anime({
|
||||||
targets: pageDiv,
|
targets: pageDiv,
|
||||||
translateX: 0,
|
translateX: 0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue