-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(animations): set smother animations for modal in ionic #31082
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e403a3a
feat(animations): set smother animations for modal in ionic
os-davidlourenco e95937d
chore(): add updated snapshots
Ionitron 41a5df8
Merge branch 'next' into ROU-12702
os-davidlourenco 792fb2c
feat(animations): removed animations identical to md
os-davidlourenco c98fc34
Merge branch 'ROU-12702' of https://github.com/ionic-team/ionic-frame…
os-davidlourenco 4140355
chore(): add updated snapshots
Ionitron 4065312
chore(): fix snapshots
os-davidlourenco c9f4c94
feat(animation): removed extra parameter from picker
os-davidlourenco f078f2b
Merge branch 'next' into ROU-12702
os-davidlourenco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/src/components/action-sheet/animations/ionic.enter.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * MD Action Sheet Enter Animation | ||
| */ | ||
| export const ionicEnterAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation | ||
| .addElement(baseEl.querySelector('ion-backdrop')!) | ||
| .fromTo('opacity', 0.01, 'var(--backdrop-opacity)') | ||
| .beforeStyles({ | ||
| 'pointer-events': 'none', | ||
| }) | ||
| .afterClearStyles(['pointer-events']); | ||
|
|
||
| wrapperAnimation | ||
| .addElement(baseEl.querySelector('.action-sheet-wrapper')!) | ||
| .fromTo('transform', 'translateY(100%)', 'translateY(0%)'); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('cubic-bezier(.36,.66,.04,1)') | ||
| .duration(400) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
24 changes: 24 additions & 0 deletions
24
core/src/components/action-sheet/animations/ionic.leave.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * MD Action Sheet Leave Animation | ||
| */ | ||
| export const ionicLeaveAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')!).fromTo('opacity', 'var(--backdrop-opacity)', 0); | ||
|
|
||
| wrapperAnimation | ||
| .addElement(baseEl.querySelector('.action-sheet-wrapper')!) | ||
| .fromTo('transform', 'translateY(0%)', 'translateY(100%)'); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('cubic-bezier(.36,.66,.04,1)') | ||
| .duration(450) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * Ionic Alert Enter Animation | ||
| */ | ||
| export const ionicEnterAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation | ||
| .addElement(baseEl.querySelector('ion-backdrop')!) | ||
| .fromTo('opacity', 0.01, 'var(--backdrop-opacity)') | ||
| .beforeStyles({ | ||
| 'pointer-events': 'none', | ||
| }) | ||
| .afterClearStyles(['pointer-events']); | ||
|
|
||
| wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')!).keyframes([ | ||
| { offset: 0, opacity: '0.01', transform: 'scale(0.9)' }, | ||
| { offset: 1, opacity: '1', transform: 'scale(1)' }, | ||
| ]); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('ease-in-out') | ||
| .duration(150) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * Md Alert Leave Animation | ||
| */ | ||
| export const ionicLeaveAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')!).fromTo('opacity', 'var(--backdrop-opacity)', 0); | ||
|
|
||
| wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')!).fromTo('opacity', 0.99, 0); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('ease-in-out') | ||
| .duration(150) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
Binary file modified
BIN
-2.92 KB
(36%)
...s-snapshots/item-sliding-rectangular-ionic-md-ltr-light-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * Ionic Loading Enter Animation | ||
| */ | ||
| export const ionicEnterAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation | ||
| .addElement(baseEl.querySelector('ion-backdrop')!) | ||
| .fromTo('opacity', 0.01, 'var(--backdrop-opacity)') | ||
| .beforeStyles({ | ||
| 'pointer-events': 'none', | ||
| }) | ||
| .afterClearStyles(['pointer-events']); | ||
|
|
||
| wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')!).keyframes([ | ||
| { offset: 0, opacity: 0.01, transform: 'scale(1.1)' }, | ||
| { offset: 1, opacity: 1, transform: 'scale(1)' }, | ||
| ]); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('ease-in-out') | ||
| .duration(200) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
|
|
||
| /** | ||
| * Md Loading Leave Animation | ||
| */ | ||
| export const ionicLeaveAnimation = (baseEl: HTMLElement): Animation => { | ||
| const baseAnimation = createAnimation(); | ||
| const backdropAnimation = createAnimation(); | ||
| const wrapperAnimation = createAnimation(); | ||
|
|
||
| backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')!).fromTo('opacity', 'var(--backdrop-opacity)', 0); | ||
|
|
||
| wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')!).keyframes([ | ||
| { offset: 0, opacity: 0.99, transform: 'scale(1)' }, | ||
| { offset: 1, opacity: 0, transform: 'scale(0.9)' }, | ||
| ]); | ||
|
|
||
| return baseAnimation | ||
| .addElement(baseEl) | ||
| .easing('ease-in-out') | ||
| .duration(200) | ||
| .addAnimation([backdropAnimation, wrapperAnimation]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
| import { getElementRoot } from '@utils/helpers'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
| import type { ModalAnimationOptions } from '../modal-interface'; | ||
|
|
||
| import { createSheetEnterAnimation } from './sheet'; | ||
|
|
||
| const createEnterAnimation = () => { | ||
| const backdropAnimation = createAnimation() | ||
| .fromTo('opacity', 0.01, 'var(--backdrop-opacity)') | ||
| .beforeStyles({ | ||
| 'pointer-events': 'none', | ||
| }) | ||
| .afterClearStyles(['pointer-events']); | ||
|
|
||
| const wrapperAnimation = createAnimation().keyframes([ | ||
| { offset: 0, opacity: 0.01, transform: 'translateY(40px)' }, | ||
| { offset: 1, opacity: 1, transform: `translateY(0px)` }, | ||
| ]); | ||
|
|
||
| return { backdropAnimation, wrapperAnimation, contentAnimation: undefined }; | ||
| }; | ||
|
|
||
| /** | ||
| * Ionic Modal Enter Animation | ||
| */ | ||
| export const ionicEnterAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptions): Animation => { | ||
| const { currentBreakpoint, expandToScroll } = opts; | ||
| const root = getElementRoot(baseEl); | ||
| const { wrapperAnimation, backdropAnimation, contentAnimation } = | ||
| currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation(); | ||
|
|
||
| backdropAnimation.addElement(root.querySelector('ion-backdrop')!); | ||
|
|
||
| wrapperAnimation.addElement(root.querySelector('.modal-wrapper')!); | ||
|
|
||
| // The content animation is only added if scrolling is enabled for | ||
| // all the breakpoints. | ||
| !expandToScroll && contentAnimation?.addElement(baseEl.querySelector('.ion-page')!); | ||
|
|
||
| backdropAnimation.duration(300).easing('ease-out'); | ||
| wrapperAnimation.duration(400).easing('cubic-bezier(0.32, 0.68, 0, 1)'); | ||
| contentAnimation?.duration(400).easing('cubic-bezier(0.32, 0.68, 0, 1)'); | ||
|
|
||
| const baseAnimation = createAnimation().addElement(baseEl).addAnimation([backdropAnimation, wrapperAnimation]); | ||
|
|
||
| if (contentAnimation) { | ||
| baseAnimation.addAnimation(contentAnimation); | ||
| } | ||
|
|
||
| return baseAnimation; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { createAnimation } from '@utils/animation/animation'; | ||
| import { getElementRoot } from '@utils/helpers'; | ||
|
|
||
| import type { Animation } from '../../../interface'; | ||
| import type { ModalAnimationOptions } from '../modal-interface'; | ||
|
|
||
| import { createSheetLeaveAnimation } from './sheet'; | ||
|
|
||
| const createLeaveAnimation = () => { | ||
| const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0); | ||
|
|
||
| const wrapperAnimation = createAnimation().keyframes([ | ||
| { offset: 0, opacity: 0.99, transform: `translateY(0px)` }, | ||
| { offset: 1, opacity: 0, transform: 'translateY(40px)' }, | ||
| ]); | ||
|
|
||
| return { backdropAnimation, wrapperAnimation }; | ||
| }; | ||
|
|
||
| /** | ||
| * Md Modal Leave Animation | ||
| */ | ||
| export const ionicLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptions): Animation => { | ||
| const { currentBreakpoint } = opts; | ||
| const root = getElementRoot(baseEl); | ||
| const { wrapperAnimation, backdropAnimation } = | ||
| currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation(); | ||
|
|
||
| backdropAnimation.addElement(root.querySelector('ion-backdrop')!); | ||
| wrapperAnimation.addElement(root.querySelector('.modal-wrapper')!); | ||
|
|
||
| backdropAnimation.duration(250).easing('ease-in'); | ||
| wrapperAnimation.duration(400).easing('cubic-bezier(0.4, 0, 1, 1)'); | ||
|
|
||
| const baseAnimation = createAnimation().addElement(baseEl).addAnimation([backdropAnimation, wrapperAnimation]); | ||
|
|
||
| return baseAnimation; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.