Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Scroll Animations #1044

Open
wants to merge 210 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 209 commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
042eafb
more or less
guysopher Nov 26, 2020
d04fbd0
is working!
guysopher Nov 27, 2020
ee7166f
exit animation
guysopher Nov 28, 2020
84d2015
better classes calc
guysopher Nov 28, 2020
f09263e
remove linter (temp)
guysopher Nov 28, 2020
ae8ac0a
add padding
guysopher Nov 28, 2020
10e4ae7
minor annimation tweeks
guysopher Nov 28, 2020
783b33e
typo
guysopher Nov 28, 2020
062df0e
anther typo
guysopher Nov 28, 2020
a9f61b2
10 iterations
guysopher Nov 28, 2020
4995a3b
add sidebar conntrols
guysopher Nov 28, 2020
81e2d81
minors
guysopher Nov 28, 2020
aa089e3
try catch localStorage
guysopher Nov 29, 2020
04cd3b1
fix horizontal animations
guysopher Nov 30, 2020
bbdcfd5
re-add easing
guysopher Nov 30, 2020
12cd45f
add comments to sidebar
guysopher Dec 6, 2020
4a6d0a5
sidebar fix
guysopher Dec 6, 2020
fbe5cb0
[gallery] fix lint errors
IzaacAyelin Nov 25, 2020
cfb1f62
[main] update changelog.md
IzaacAyelin Nov 25, 2020
a8f956b
v2.2.28
IzaacAyelin Nov 25, 2020
e3d012a
[gallery+layouts] (package.json): added typescript to devDependencies
ritabazak Nov 25, 2020
2b1c98f
[gallery] tests: added tests for itemShadow styleParams
Nov 29, 2020
604505c
[main] added pre-commit of lint:fix
ritabazak Nov 29, 2020
dedc6a4
[gallery] prerender changed from viewMode to prop
yhattav Nov 30, 2020
4e2c47d
[main] update changelog.md
yhattav Nov 30, 2020
e1db5a1
v2.3.0
yhattav Nov 30, 2020
c6d2aab
[main+gallery+ssr-simulator] tests: configure tests to run different …
IzaacAyelin Nov 30, 2020
e34d490
[gallery] put back test script
IzaacAyelin Nov 30, 2020
4497af1
[gallery] test: added e2e test for overlayBackground SP
yakovhaiilo Nov 30, 2020
6904ec0
[gallery] fix (galleryScrollIndicator): get oneRow from props
aviranhuga Dec 1, 2020
cb31805
[gallery] itemClick defaults to 'nothing'
johnbenz13 Dec 1, 2020
e2e1894
[main] update changelog.md
yhattav Dec 2, 2020
11177b2
v2.3.1
yhattav Dec 2, 2020
551f76f
[playground] feature: add the option to use blueprints server
guysopher Dec 2, 2020
3af532b
[playground] fix: fix request for blueprint on server - when cors is …
guysopher Dec 2, 2020
9b5cf78
[playground] fix: do not create blueprint if one param is missing
guysopher Dec 3, 2020
18e1e95
[main] delete tests script before patch/minor/major
IzaacAyelin Dec 3, 2020
0076f5a
[gallery] test: add e2e test to gallerySizeType SP
yakovhaiilo Dec 3, 2020
35041cb
[lib] delete old settings
IzaacAyelin Dec 3, 2020
a661d92
[layouts] feature: add (and fix) the columnsWidths feature to the pla…
guysopher Dec 6, 2020
4a36f02
[lib] fix lint error
IzaacAyelin Dec 6, 2020
1041a6c
[lib] exporting blueprint and allowing for passing a createBlueprintsImp
yhattav Dec 6, 2020
32c2e15
[lib] create blueprints should get an object as params
yhattav Dec 6, 2020
4611eb8
[lib] playground settings: edited gallerySizeRatio description
yakovhaiilo Dec 6, 2020
42beb78
[gallery] test: edited gallerySizeType SP e2e tests description
yakovhaiilo Dec 6, 2020
f62c350
[lib] correct export for blueprints
yhattav Dec 6, 2020
d762e0f
[lib] await for blueprint
yhattav Dec 7, 2020
518c62f
[main] update changelog.md
yhattav Dec 7, 2020
6924243
v2.3.2
yhattav Dec 7, 2020
9130c8f
[lib] wrap createBlueprints function
yhattav Dec 7, 2020
2a8960b
[main] update changelog.md
yhattav Dec 7, 2020
655fcbd
v2.3.3
yhattav Dec 7, 2020
5076e3f
[gallery] tests: added e2e test to rotatingCropRatios SP
yakovhaiilo Dec 7, 2020
11f8f13
[lean-gallery] Initial commit for new lean-gallery pacakge
ido-postelnik Dec 8, 2020
67a8016
[main] Update releaseVersion file with 'lean-gallery'
ido-postelnik Dec 8, 2020
f8b4351
[main] update changelog.md
ido-postelnik Dec 8, 2020
f80fef5
v2.3.4
ido-postelnik Dec 8, 2020
58690c2
[gallery] tests: added unit test to slideAnimation SP
yakovhaiilo Dec 9, 2020
1a811a1
[main + gallery + playground + lean-gallery] Remove leanGallery usage…
ido-postelnik Dec 9, 2020
562436c
[main] update changelog.md
ido-postelnik Dec 9, 2020
b86f1ce
v2.3.5
ido-postelnik Dec 9, 2020
2bc621e
[gallery] improve (video): improve video loading flow for smoother pl…
guysopher Dec 10, 2020
d19fc18
[main] update changelog.md
yhattav Dec 10, 2020
1896770
v2.3.6
yhattav Dec 10, 2020
5b2886c
[playground] fix (settings): remove itemClick from playground and fix…
guysopher Dec 10, 2020
2ee2e78
Revert "[gallery] improve (video): improve video loading flow for smo…
yhattav Dec 13, 2020
af504ad
[gallery] loadMoreButton mobile styles will be set via Wix dynamic cs…
ritabazak Dec 13, 2020
db0df54
[main] update changelog.md
yhattav Dec 13, 2020
758fb9e
v2.3.7
yhattav Dec 13, 2020
04b226c
[playground] fix (settings): move showArrows param
guysopher Dec 10, 2020
9349243
[layouts] fix (layouter): fix columnsWidth logic when more columns ar…
guysopher Dec 13, 2020
a8e0331
[playground + leanGallery] Enable render of leanGallery in Playground
ido-postelnik Dec 14, 2020
25bee2f
[main] update changelog.md
ido-postelnik Dec 14, 2020
aeade05
v2.3.8
ido-postelnik Dec 14, 2020
6b7552a
[gallery] fix (layoutFixer): make the createLayout async (to be remote)
guysopher Dec 14, 2020
31ee7d0
[main] update changelog.md
guysopher Dec 14, 2020
07d1fcd
v2.3.9
guysopher Dec 14, 2020
c93af0f
refactor
guysopher Dec 15, 2020
8d73ff0
fix tests
guysopher Dec 15, 2020
b87ef66
Merge branch 'master' into nov26_linearAnimations
guysopher Dec 22, 2020
ce02426
merged
guysopher Dec 22, 2020
91f5255
improve animations
guysopher Dec 22, 2020
76ff32e
fix expand / shrink
guysopher Dec 23, 2020
e4baa72
fix blue and main color animations
guysopher Dec 28, 2020
dede74a
[gallery] tests: added e2e test to scrollAnimations SP
yakovhaiilo Dec 22, 2020
055b795
[main] update changelog.md
guysopher Dec 22, 2020
22e7ace
v2.4.3
guysopher Dec 22, 2020
7983ba5
[gallery] fix: play button doesn't show when needed
IzaacAyelin Dec 23, 2020
12f05b6
[main] update changelog.md
IzaacAyelin Dec 23, 2020
f5f11d7
v2.4.4
IzaacAyelin Dec 23, 2020
f07fa53
[gallery] fix extra play button in placeholder
IzaacAyelin Dec 23, 2020
28cc976
[main] update changelog.md
IzaacAyelin Dec 23, 2020
5e6547e
v2.4.5
IzaacAyelin Dec 23, 2020
aea31e4
[gallery + playground] tests: added e2e test to loadMoreAmount SP and…
yakovhaiilo Dec 24, 2020
2cdfb0b
[lib] changed scrollAnimation isRelevantDescription
yakovhaiilo Dec 24, 2020
2d5f5eb
[gallery] improve (horizontalScroll): dispatch an event to the scroll…
guysopher Dec 28, 2020
9c1fa3e
minors
guysopher Dec 28, 2020
aa753c5
[all] fix: fix broken tests and clean the test log
guysopher Dec 29, 2020
d491194
remove localStorage params
guysopher Jan 3, 2021
d5d73f6
move css animations to blueprints
guysopher Jan 4, 2021
33b8a5d
try to create cssAnimations in the blueprint
guysopher Jan 5, 2021
f56f456
try to create cssAnimations in the blueprint
guysopher Jan 5, 2021
d95261c
scrollAnimations render element
guysopher Jan 5, 2021
40b01b9
Merge branch 'master' into nov26_linearAnimations
IzaacAyelin Jun 23, 2021
58952ff
nothing really
guysopher Jun 23, 2022
ba79b28
add console
guysopher Jun 26, 2022
59ebe37
a try with re-calc of last 3 strips - creates too many laytous
guysopher Jun 29, 2022
e61b5c6
create alignment with prediction
guysopher Jun 29, 2022
6f60a0a
add playground control
guysopher Jun 29, 2022
f21fcd6
add playground control
guysopher Jun 29, 2022
c5c1607
Merge branch 'master' into Jun23_lastLineFixer
guysopher Jun 29, 2022
e22b8f9
fix infinite scroll
guysopher Jul 3, 2022
9e63dbf
Merge branch 'Jun23_lastLineFixer' of github.com:wix/pro-gallery into…
guysopher Jul 3, 2022
ac192d4
pre calc groups per strip, last group size, and prefer splitting stri…
guysopher Jul 3, 2022
11c27b2
add forceFullStrips to default options (temporary)
guysopher Jul 3, 2022
f592d4d
add forceFullStrips to default options (temporary)
guysopher Jul 3, 2022
783b43c
add forceFullStrips to default options (temporary)
guysopher Jul 3, 2022
ba1ce23
Merge branch 'master' into nov26_linearAnimations
guysopher Aug 4, 2022
08928b8
working on making it run
guysopher Aug 15, 2022
eb0c79c
making it work (fix confusion between itemId and galleryId)
guysopher Aug 22, 2022
0338912
move animations logic to seperate file
guysopher Aug 22, 2022
34de852
renaming animation variables for clarity
guysopher Aug 22, 2022
b171edb
fixed animations css to make it beautiful
guysopher Aug 22, 2022
e0bf0dd
fixed horizontal scroll
guysopher Aug 22, 2022
f3bdf1c
minors
guysopher Aug 22, 2022
1d95af8
Merge branch 'Jun23_lastLineFixer' into nov26_linearAnimations
guysopher Aug 22, 2022
67a5bb5
Merge branch 'master' into nov26_linearAnimations
guysopher Aug 22, 2022
acf9b7a
add scrollAnimationIntensity param
guysopher Aug 23, 2022
b99cc99
some animations values adjustments
guysopher Aug 23, 2022
7edd0f8
add slide left animation
guysopher Aug 23, 2022
3a45c54
add more animations
guysopher Aug 24, 2022
fb53cb1
remove perspective from itemView
guysopher Aug 24, 2022
695aa66
add the options for multiselect on animations
guysopher Aug 24, 2022
0882086
trying (and failing) to merge selectors
guysopher Aug 28, 2022
00d5e73
Revert "trying (and failing) to merge selectors"
guysopher Aug 28, 2022
1538a12
Revert "add the options for multiselect on animations"
guysopher Aug 28, 2022
353de31
bug fixes
guysopher Aug 28, 2022
b4e5e26
stop animations when stops scrolling
guysopher Sep 1, 2022
998ee82
seperate x and y scroll
guysopher Sep 1, 2022
12db3e2
minor refactor
guysopher Sep 4, 2022
743ac6a
add multiselect for animations
guysopher Sep 4, 2022
3f3683c
properly enable multiple selectors !!!!!!!
guysopher Sep 6, 2022
78e3b00
add scrollAnimationReset control
guysopher Sep 6, 2022
37410a9
save old animation helper
guysopher Sep 6, 2022
9d61b6a
allow different entry and exit animations
guysopher Sep 6, 2022
b385584
fix rotate animation
guysopher Sep 6, 2022
51d6fdc
add scrollAnimationDistance param
guysopher Sep 7, 2022
9759941
add more animations
guysopher Sep 7, 2022
4dfd473
add shadow animation and direction for hinge and rotate
guysopher Sep 7, 2022
34629af
fix queeze animation
guysopher Sep 7, 2022
064d1c2
fix for pan and appear animations
guysopher Sep 8, 2022
a33f106
add (bad) reveal animation
guysopher Sep 11, 2022
d8ecb07
cleanup
guysopher Sep 11, 2022
234f1d9
add slew and spiral animations
guysopher Sep 12, 2022
d9e877c
fine tune
guysopher Sep 12, 2022
d8837ba
fix scaling calc for scaled animations
guysopher Sep 12, 2022
d36b1d8
reduce number of iterations
guysopher Sep 12, 2022
73a5f4a
basic animation loop
guysopher Jan 8, 2023
8894d06
basic usage of advancedScrollAnimations
guysopher Jan 9, 2023
5b929f9
add json editor
guysopher Jan 9, 2023
349246e
merged master
guysopher Jan 9, 2023
12e71e4
tried to add the new style param
guysopher Jan 9, 2023
353662a
tried to add the new style param
guysopher Jan 9, 2023
a719007
addnew option to types
IzaacAyelin Jan 9, 2023
4b2fa1a
minor
guysopher Jan 9, 2023
8d9767e
fade and grayscale animations working
guysopher Jan 9, 2023
e916481
fix url to json issues
guysopher Jan 9, 2023
bba7f7a
add more animations
guysopher Jan 10, 2023
2f9936a
finish all animations
guysopher Jan 10, 2023
0b1aca2
fix rotation animations
guysopher Jan 10, 2023
2577a7e
minor performamnce issues
guysopher Jan 14, 2023
acf8f45
fix top anchor issue and add ease option
guysopher Jan 15, 2023
6e5ba46
add many types of easing
guysopher Jan 15, 2023
f3f7d76
more easing
guysopher Jan 15, 2023
fa9847a
use multiple transition properties
guysopher Jan 16, 2023
0283150
create css animations on load + add randomOffset
guysopher Jan 16, 2023
c7eda36
fix animated properties
guysopher Jan 16, 2023
c228265
add infiniteScrollAnimation and scrollAnimationReset params
guysopher Jan 17, 2023
a246c93
remove global css for animations
guysopher Jan 17, 2023
946448d
merged master
guysopher Jan 25, 2023
2647c78
undo the bug I did
guysopher Jan 25, 2023
061c2b7
add relative directions
guysopher Jan 25, 2023
fd23586
fix stuff
guysopher Jan 25, 2023
e83a495
remove useMemo
guysopher Jan 26, 2023
f8e831f
fix groups options in playground
guysopher Jan 30, 2023
bce552a
merge master
guysopher May 16, 2023
f38b7d3
merge fixes
guysopher May 16, 2023
10baf81
fix prettier and galleryContainer
guysopher May 16, 2023
b53412f
finish merge
guysopher May 16, 2023
357abbe
fix linter issues
guysopher May 17, 2023
0db7f4f
fix linter issues
guysopher May 17, 2023
f27cb3c
fix more linter issues
guysopher May 17, 2023
20bfe14
lint playground
guysopher Jun 5, 2023
8ab635e
retrieve the layouts package to its state in the master
guysopher Jun 5, 2023
8740b49
fix groups options in playground
guysopher Jan 30, 2023
147b820
fix groups options in playground
guysopher Jan 30, 2023
aa218e3
add many simple to advanced converters
guysopher Jun 13, 2023
685afd4
rename to jsonScrollAnimation
guysopher Jun 13, 2023
38ee182
renaming stuff
guysopher Jun 13, 2023
6f25ced
renaiming playground
guysopher Jun 13, 2023
35a21db
fix some style params
guysopher Jun 13, 2023
05e61da
remove all migration tests
guysopher Jun 13, 2023
ae51180
Revert "remove all migration tests"
guysopher Jun 13, 2023
600cac8
show ready animations as scrollAniamtion
guysopher Jun 14, 2023
18ea3d5
Izaac claims this is ok
guysopher Jun 15, 2023
757ef41
tests
IzaacAyelin Jun 15, 2023
50ac72e
revert itenView
guysopher Jun 18, 2023
9bf2a6b
revert mediaItem changes
guysopher Jun 18, 2023
5f20295
fix scrollAnimationCss tag
guysopher Jun 18, 2023
74639de
Yonatan review
guysopher Jun 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ci:test-e2e-layouts": "start-server-and-test ci:run-playground http-get://localhost:3006 'lerna run test:e2e-layouts'",
"ci:test-e2e-styleParams": "start-server-and-test ci:run-playground http-get://localhost:3006 'lerna run test:e2e-styleParams'",
"ci:test-e2e-integration": "start-server-and-test ci:run-playground http-get://localhost:3006 'lerna run test:e2e-integration'",
"build-all-and-start-playground": "npm run start-playground"
"build-all-and-start-playground": "cd packages/lib && npm run build && cd ../layouts && npm run build && cd ../blueprints && npm run build && cd ../gallery && npm run build && cd ../playground && npm start"
},
"husky": {
"hooks": {
Expand Down
10,039 changes: 10,039 additions & 0 deletions packages/gallery/package-lock.json

Large diffs are not rendered by default.

357 changes: 357 additions & 0 deletions packages/gallery/src/common/utils/easing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,357 @@
export function easeInQuad(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * (elapsed /= duration) * elapsed + initialValue;
}

export function easeOutQuad(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return -amountOfChange * (elapsed /= duration) * (elapsed - 2) + initialValue;
}

export function easeInOutQuad(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * elapsed * elapsed + initialValue;
}
return (-amountOfChange / 2) * (--elapsed * (elapsed - 2) - 1) + initialValue;
}

export function easeInCubic(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * (elapsed /= duration) * elapsed * elapsed + initialValue;
}

export function easeOutCubic(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * ((elapsed = elapsed / duration - 1) * elapsed * elapsed + 1) + initialValue;
}

export function easeInOutCubic(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * elapsed * elapsed * elapsed + initialValue;
}
return (amountOfChange / 2) * ((elapsed -= 2) * elapsed * elapsed + 2) + initialValue;
}

export function easeInQuart(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * (elapsed /= duration) * elapsed * elapsed * elapsed + initialValue;
}

export function easeOutQuart(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return -amountOfChange * ((elapsed = elapsed / duration - 1) * elapsed * elapsed * elapsed - 1) + initialValue;
}

export function easeInOutQuart(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * elapsed * elapsed * elapsed * elapsed + initialValue;
}
return (-amountOfChange / 2) * ((elapsed -= 2) * elapsed * elapsed * elapsed - 2) + initialValue;
}

export function easeInQuint(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * (elapsed /= duration) * elapsed * elapsed * elapsed * elapsed + initialValue;
}

export function easeOutQuint(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return (
amountOfChange * ((elapsed = elapsed / duration - 1) * elapsed * elapsed * elapsed * elapsed + 1) + initialValue
);
}

export function easeInOutQuint(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * elapsed * elapsed * elapsed * elapsed * elapsed + initialValue;
}
return (amountOfChange / 2) * ((elapsed -= 2) * elapsed * elapsed * elapsed * elapsed + 2) + initialValue;
}

export function easeInSine(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return -amountOfChange * Math.cos((elapsed / duration) * (Math.PI / 2)) + amountOfChange + initialValue;
return -amountOfChange * Math.cos((elapsed / duration) * (Math.PI / 2)) + amountOfChange + initialValue;
// return amountOfChange * (1 - Math.cos(x * (Math.PI / 2))) + initialValue;

// x = (elapsed / duration)
//1 - Math.cos((x * Math.PI) / 2);
}

export function easeOutSine(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * Math.sin((elapsed / duration) * (Math.PI / 2)) + initialValue;
}

export function easeInOutSine(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return (-amountOfChange / 2) * (Math.cos((Math.PI * elapsed) / duration) - 1) + initialValue;
}

export function easeInExpo(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return elapsed === 0 ? initialValue : amountOfChange * Math.pow(2, 10 * (elapsed / duration - 1)) + initialValue;
}

export function easeOutExpo(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return elapsed === duration
? initialValue + amountOfChange
: amountOfChange * (-Math.pow(2, (-10 * elapsed) / duration) + 1) + initialValue;
}

export function easeInOutExpo(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
if (elapsed === 0) {
return initialValue;
}
if (elapsed === duration) {
return initialValue + amountOfChange;
}
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * Math.pow(2, 10 * (elapsed - 1)) + initialValue;
}
return (amountOfChange / 2) * (-Math.pow(2, -10 * --elapsed) + 2) + initialValue;
}

export function easeInCirc(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return -amountOfChange * (Math.sqrt(1 - (elapsed /= duration) * elapsed) - 1) + initialValue;
}

export function easeOutCirc(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange * Math.sqrt(1 - (elapsed = elapsed / duration - 1) * elapsed) + initialValue;
}

export function easeInOutCirc(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
if ((elapsed /= duration / 2) < 1) {
return (-amountOfChange / 2) * (Math.sqrt(1 - elapsed * elapsed) - 1) + initialValue;
}
return (amountOfChange / 2) * (Math.sqrt(1 - (elapsed -= 2) * elapsed) + 1) + initialValue;
}

export function easeInElastic(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
let s = 1.70158;
let p = 0;
let a = amountOfChange;
if (elapsed === 0) {
return initialValue;
}
if ((elapsed /= duration) === 1) {
return initialValue + amountOfChange;
}
if (!p) {
p = duration * 0.3;
}
if (a < Math.abs(amountOfChange)) {
a = amountOfChange;
s = p / 4;
} else {
s = (p / (2 * Math.PI)) * Math.asin(amountOfChange / a);
}
return (
-(a * Math.pow(2, 10 * (elapsed -= 1)) * Math.sin(((elapsed * duration - s) * (2 * Math.PI)) / p)) + initialValue
);
}

export function easeOutElastic(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
let s = 1.70158;
let p = 0;
let a = amountOfChange;
if (elapsed === 0) {
return initialValue;
}
if ((elapsed /= duration) === 1) {
return initialValue + amountOfChange;
}
if (!p) {
p = duration * 0.3;
}
if (a < Math.abs(amountOfChange)) {
a = amountOfChange;
s = p / 4;
} else {
s = (p / (2 * Math.PI)) * Math.asin(amountOfChange / a);
}
return (
a * Math.pow(2, -10 * elapsed) * Math.sin(((elapsed * duration - s) * (2 * Math.PI)) / p) +
amountOfChange +
initialValue
);
}

export function easeInOutElastic(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
let s = 1.70158;
let p = 0;
let a = amountOfChange;
if (elapsed === 0) {
return initialValue;
}
if ((elapsed /= duration / 2) === 2) {
return initialValue + amountOfChange;
}
if (!p) {
p = duration * (0.3 * 1.5);
}
if (a < Math.abs(amountOfChange)) {
a = amountOfChange;
s = p / 4;
} else {
s = (p / (2 * Math.PI)) * Math.asin(amountOfChange / a);
}
if (elapsed < 1) {
return (
-0.5 * (a * Math.pow(2, 10 * (elapsed -= 1)) * Math.sin(((elapsed * duration - s) * (2 * Math.PI)) / p)) +
initialValue
);
}
return (
a * Math.pow(2, -10 * (elapsed -= 1)) * Math.sin(((elapsed * duration - s) * (2 * Math.PI)) / p) * 0.5 +
amountOfChange +
initialValue
);
}

export function easeInBack(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number,
s = 1.70158
): number {
return amountOfChange * (elapsed /= duration) * elapsed * ((s + 1) * elapsed - s) + initialValue;
}

export function easeOutBack(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number,
s = 1.70158
): number {
return amountOfChange * ((elapsed = elapsed / duration - 1) * elapsed * ((s + 1) * elapsed + s) + 1) + initialValue;
}

export function easeInOutBack(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number,
s = 1.70158
): number {
if ((elapsed /= duration / 2) < 1) {
return (amountOfChange / 2) * (elapsed * elapsed * (((s *= 1.525) + 1) * elapsed - s)) + initialValue;
}
return (amountOfChange / 2) * ((elapsed -= 2) * elapsed * (((s *= 1.525) + 1) * elapsed + s) + 2) + initialValue;
}

export function easeInBounce(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return amountOfChange - easeOutBounce(duration - elapsed, 0, amountOfChange, duration) + initialValue;
}

export function easeOutBounce(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
if ((elapsed /= duration) < 1 / 2.75) {
return amountOfChange * (7.5625 * elapsed * elapsed) + initialValue;
} else if (elapsed < 2 / 2.75) {
return amountOfChange * (7.5625 * (elapsed -= 1.5 / 2.75) * elapsed + 0.75) + initialValue;
} else if (elapsed < 2.5 / 2.75) {
return amountOfChange * (7.5625 * (elapsed -= 2.25 / 2.75) * elapsed + 0.9375) + initialValue;
} else {
return amountOfChange * (7.5625 * (elapsed -= 2.625 / 2.75) * elapsed + 0.984375) + initialValue;
}
}

export function easeInOutBounce(
elapsed: number,
initialValue: number,
amountOfChange: number,
duration: number
): number {
if (elapsed < duration / 2) {
return easeInBounce(elapsed * 2, 0, amountOfChange, duration) * 0.5 + initialValue;
}
return easeOutBounce(elapsed * 2 - duration, 0, amountOfChange, duration) * 0.5 + amountOfChange * 0.5 + initialValue;
}

export function linear(elapsed: number, initialValue: number, amountOfChange: number, duration: number): number {
return (amountOfChange * elapsed) / duration + initialValue;
//const val = (elapsed / duration) * (amountOfChange) + initialValue;
//const val = (_step) * (to - from) + from;
}

export const easingFunctions = {
linear,
easeInQuad,
easeOutQuad,
easeInOutQuad,
easeInCubic,
easeOutCubic,
easeInOutCubic,
easeInQuart,
easeOutQuart,
easeInOutQuart,
easeInQuint,
easeOutQuint,
easeInOutQuint,
easeInSine,
easeOutSine,
easeInOutSine,
easeInExpo,
easeOutExpo,
easeInOutExpo,
easeInCirc,
easeOutCirc,
easeInOutCirc,
easeInElastic,
easeOutElastic,
easeInOutElastic,
easeInBack,
easeOutBack,
easeInOutBack,
easeInBounce,
easeOutBounce,
easeInOutBounce,
};

export const cssEasing = {
easeInSine: 'cubic-bezier(0.12, 0, 0.39, 0)',
easeOutSine: 'cubic-bezier(0.61, 1, 0.88, 1)',
easeInOutSine: 'cubic-bezier(0.37, 0, 0.63, 1)',
easeInQuad: 'cubic-bezier(0.11, 0, 0.5, 0)',
easeOutQuad: 'cubic-bezier(0.5, 1, 0.89, 1)',
easeInOutQuad: 'cubic-bezier(0.45, 0, 0.55, 1)',
easeInCubic: 'cubic-bezier(0.32, 0, 0.67, 0)',
easeOutCubic: 'cubic-bezier(0.33, 1, 0.68, 1)',
easeInOutCubic: 'cubic-bezier(0.65, 0, 0.35, 1)',
easeInQuart: 'cubic-bezier(0.5, 0, 0.75, 0)',
easeOutQuart: 'cubic-bezier(0.25, 1, 0.5, 1)',
easeInOutQuart: 'cubic-bezier(0.76, 0, 0.24, 1)',
easeInQuint: 'cubic-bezier(0.64, 0, 0.78, 0)',
easeOutQuint: 'cubic-bezier(0.22, 1, 0.36, 1)',
easeInOutQuint: 'cubic-bezier(0.83, 0, 0.17, 1)',
easeInExpo: 'cubic-bezier(0.7, 0, 0.84, 0)',
easeOutExpo: 'cubic-bezier(0.16, 1, 0.3, 1)',
easeInOutExpo: 'cubic-bezier(0.87, 0, 0.13, 1)',
easeInCirc: 'cubic-bezier(0.55, 0, 1, 0.45)',
easeOutCirc: 'cubic-bezier(0, 0.55, 0.45, 1)',
easeInOutCirc: 'cubic-bezier(0.85, 0, 0.15, 1)',
easeInBack: 'cubic-bezier(0.36, 0, 0.66, -0.56)',
easeOutBack: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
easeInOutBack: 'cubic-bezier(0.68, -0.6, 0.32, 1.6)',
easeInElastic: 'cubic-bezier(0.47, 0, 0.745, 0.715)',
easeOutElastic: 'cubic-bezier(0.39, 0.575, 0.565, 1)',
easeInOutElastic: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)',
easeInBounce: 'cubic-bezier(0.71, 1.7, 0.735, 1.705)',
easeOutBounce: 'cubic-bezier(0.3, -0.6, 0.335, -0.605)',
easeInOutBounce: 'cubic-bezier(0.895, 0.03, 0.685, 0.22)',
};
Loading