mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-10-14 21:42:51 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dd01a7cc5 |
@@ -18,11 +18,7 @@ import {AnimationOptions} from '@ionic/angular/common/providers/nav-controller';
|
||||
import {iosDuration, iosEasing, mdDuration, mdEasing} from './easings';
|
||||
|
||||
/**
|
||||
* Creates the page transition used when opening a page via a FAB: the FAB grows
|
||||
* towards the screen while the new page fades in on top of it. Going back, the
|
||||
* page fades out and reveals the previous page beneath it.
|
||||
* @param animationController Ionic animation controller used to build the animation
|
||||
* @returns animation builder to pass to `[routerAnimation]`
|
||||
*
|
||||
*/
|
||||
export function fabExpand(animationController: AnimationController): AnimationBuilder {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -41,11 +37,18 @@ export function fabExpand(animationController: AnimationController): AnimationBu
|
||||
|
||||
const useReducedMotion = viewBounds.width > 500;
|
||||
const reducedMotionTransform = `${Math.min(viewBounds.width * 0.3, 200)}px`;
|
||||
const reducedMotionViewBorderRadius = '128px';
|
||||
const reducedMotionFabGrow = '2';
|
||||
const reducedMotionViewShrink = '0.9';
|
||||
|
||||
const viewCenterX = (viewBounds.width - viewBounds.x) / 2;
|
||||
const viewCenterY = (viewBounds.height - viewBounds.y) / 2;
|
||||
|
||||
const viewOnFab = useReducedMotion
|
||||
? `translate(${reducedMotionTransform}, ${reducedMotionTransform}) scale(${reducedMotionViewShrink})`
|
||||
: `translate(${(fabBounds.x - viewBounds.x) / 2}px, ${(fabBounds.y - viewBounds.y) / 2}px) scale(${
|
||||
fabBounds.width / viewBounds.width
|
||||
}, ${fabBounds.height / viewBounds.height})`;
|
||||
const fabOnView = useReducedMotion
|
||||
? `translate(-${reducedMotionTransform}, -${reducedMotionTransform}) scale(${reducedMotionFabGrow})`
|
||||
: `translate(${viewCenterX - fabBounds.x}px, ${viewCenterY - fabBounds.y}px) scale(${
|
||||
@@ -53,6 +56,8 @@ export function fabExpand(animationController: AnimationController): AnimationBu
|
||||
}, ${viewBounds.height / fabBounds.height})`;
|
||||
const transformNormal = `translate(0px, 0px) scale(1, 1)`;
|
||||
|
||||
const viewBorderRadius = useReducedMotion ? reducedMotionViewBorderRadius : '50%';
|
||||
|
||||
const fabViewFade = animationController
|
||||
.create()
|
||||
.beforeStyles({zIndex: -1})
|
||||
@@ -64,12 +69,13 @@ export function fabExpand(animationController: AnimationController): AnimationBu
|
||||
.fromTo('transform', back ? fabOnView : transformNormal, back ? transformNormal : fabOnView)
|
||||
.fromTo('opacity', back ? '0' : '1', back ? '1' : '0')
|
||||
.fromTo('borderRadius', back ? '0' : '50%', back ? '50%' : '0')
|
||||
.addElement(back ? [] : fab);
|
||||
.addElement(fab);
|
||||
const viewGrow = animationController
|
||||
.create()
|
||||
.beforeStyles({zIndex: 200, overflow: 'hidden', transformOrigin: 'center'})
|
||||
.fromTo('transform', back ? transformNormal : viewOnFab, back ? viewOnFab : transformNormal)
|
||||
.fromTo('opacity', back ? '1' : '0', back ? '0' : '1')
|
||||
.afterStyles(back ? {display: 'none'} : {})
|
||||
.fromTo('borderRadius', back ? '0' : viewBorderRadius, back ? viewBorderRadius : '0')
|
||||
.addElement(otherView);
|
||||
|
||||
return rootTransition.addAnimation(fabGrow).addAnimation(viewGrow).addAnimation(fabViewFade);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
.release-notes {
|
||||
max-width: 16cm;
|
||||
}
|
||||
|
||||
.release-notes ::ng-deep {
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
|
||||
+1
-9
@@ -17,12 +17,7 @@ import {AnimationController} from '@ionic/angular/standalone';
|
||||
import {AnimationOptions} from '@ionic/angular/common/providers/nav-controller';
|
||||
|
||||
/**
|
||||
* Creates the page transition used when opening the search from the search field
|
||||
* on the home page: the search bar moves up into the header of the search page,
|
||||
* which fades in on top while the home page content slides away. Going back plays
|
||||
* the same animation in reverse.
|
||||
* @param animationController Ionic animation controller used to build the animation
|
||||
* @returns animation builder to pass to `[routerAnimation]`
|
||||
*
|
||||
*/
|
||||
export function homePageSearchTransition(animationController: AnimationController) {
|
||||
let scheduleTransform: WebKitCSSMatrix;
|
||||
@@ -58,9 +53,6 @@ export function homePageSearchTransition(animationController: AnimationControlle
|
||||
const headerDelta = homeHeaderHeight - searchHeaderHeight;
|
||||
|
||||
const enterTransition = animationController.create().fromTo('opacity', '0', '1').addElement(searchPage);
|
||||
if (back) {
|
||||
enterTransition.afterStyles({display: 'none'});
|
||||
}
|
||||
const exitTransition = animationController.create().fromTo('opacity', '1', '1').addElement(homePage);
|
||||
|
||||
const homePageSlide = animationController
|
||||
|
||||
@@ -101,7 +101,6 @@ export function mapMaximizeAnimation(animationController: AnimationController):
|
||||
const exitTransition = animationController
|
||||
.create()
|
||||
.fromTo('opacity', '1', options.direction === 'back' ? '0' : '1')
|
||||
.afterStyles(options.direction === 'back' ? {display: 'none'} : {})
|
||||
.addElement(options.leavingEl);
|
||||
|
||||
rootTransition.addAnimation([enterTransition, exitTransition, mapEnterTransition, mapExitTransition]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
import packageJson from './package.json' assert {type: 'json'};
|
||||
import packageJson from './package.json' with {type: 'json'};
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
|
||||
Reference in New Issue
Block a user