ngx-easy-view-transitions 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,22 +18,14 @@ Available on [npm](https://www.npmjs.org/package/ngx-easy-view-transitions/).
18
18
  npm install ngx-easy-view-transitions
19
19
  ```
20
20
 
21
- | Package version | Angular version |
22
- |-----------------|-----------------|
23
- | `3.x.x` | `>=19.0.0` |
24
- | `2.x.x` | `>=18.0.0` |
25
- | `1.x.x` | `^17.3.0` |
21
+ Required Angular version: `>=19.0.0`
26
22
 
27
23
  You have to enable Angulars built-in view transitions in the Router using the [`withViewTransitions()`](https://angular.io/api/router/withViewTransitions#usage-notes) function.
28
24
 
29
25
  ```typescript
30
- bootstrapApplication(AppComponent,
31
- {
32
- providers: [
33
- provideRouter(appRoutes, withViewTransitions())
34
- ]
35
- }
36
- );
26
+ bootstrapApplication(AppComponent, {
27
+ providers: [provideRouter(appRoutes, withViewTransitions())]
28
+ });
37
29
  ```
38
30
 
39
31
  ## Usage
@@ -43,7 +35,7 @@ bootstrapApplication(AppComponent,
43
35
  To morph an element during navigation from the old to the new state use the `transitionName` directive and provide the same name on both pages.
44
36
 
45
37
  ```typescript
46
- import { TransitionNameDirective } from 'ngx-easy-view-transitions';
38
+ import {TransitionNameDirective} from 'ngx-easy-view-transitions';
47
39
  ```
48
40
 
49
41
  `users.component.html`
@@ -82,8 +74,8 @@ You can simply use a CSS [`@keyframes`](https://developer.mozilla.org/en-US/docs
82
74
  ```
83
75
 
84
76
  ```typescript
85
- inAnimation = { keyframeName: 'fadeIn', duration: 600 };
86
- outAnimation = { keyframeName: 'fadeIn', duration: 600, reverse: true };
77
+ inAnimation = {keyframeName: 'fadeIn', duration: 600};
78
+ outAnimation = {keyframeName: 'fadeIn', duration: 600, reverse: true};
87
79
  ```
88
80
 
89
81
  ```angular2html
@@ -98,42 +90,59 @@ When you want to use typed objects instead of CSS you can provide a [`Keyframe`]
98
90
  const fadeIn: Keyframe[] = [
99
91
  {
100
92
  opacity: 0,
101
- offset: 0,
93
+ offset: 0
102
94
  },
103
95
  {
104
96
  opacity: 1,
105
- offset: 1,
106
- },
97
+ offset: 1
98
+ }
107
99
  ];
108
100
  ```
109
101
 
110
102
  ```typescript
111
- inAnimation = { keyframes: fadeIn, duration: 600 };
112
- outAnimation = { keyframes: fadeIn, duration: 600, reverse: true };
103
+ inAnimation = {keyframes: fadeIn, duration: 600};
104
+ outAnimation = {keyframes: fadeIn, duration: 600, reverse: true};
113
105
  ```
114
106
 
115
107
  ```angular2html
116
108
  <img transitionName="profile-picture" [inAnimation]="inAnimation" [outAnimation]="outAnimation" src="...">
117
109
  ```
118
110
 
111
+ #### Further customization
112
+
113
+ You can further customize the animation by passing standard
114
+ [CSS animation properties](https://developer.mozilla.org/de/docs/Web/CSS/Reference/Properties/animation),
115
+ such as `fill-mode`, `delay`, or `timing-function`.
116
+
117
+ ```ts
118
+ animation = {
119
+ keyframeName: 'fadeIn',
120
+ duration: 600,
121
+ reverse: true,
122
+ fillMode: 'forwards',
123
+ timingFunction: 'ease-in',
124
+ delay: 100
125
+ };
126
+ ```
127
+
119
128
  ### Built-In animations
120
129
 
121
130
  To start faster there are some built-in animations available under `DefaultTransitions.*`.
122
131
 
123
132
  ```typescript
124
- import { DefaultTransitions } from 'ngx-easy-view-transitions';
133
+ import {DefaultTransitions} from 'ngx-easy-view-transitions';
125
134
 
126
- inAnimation = { keyframes: DefaultTransitions.fadeInUp, duration: 600 };
135
+ inAnimation = {keyframes: DefaultTransitions.fadeInUp, duration: 600};
127
136
  ```
128
137
 
129
138
  You can see them in the [demo](https://derstimmler.github.io/ngx-easy-view-transitions/animations) and [here](https://github.com/DerStimmler/ngx-easy-view-transitions/blob/main/ngx-easy-view-transitions/src/lib/default-transitions.ts).
130
139
 
131
140
  ### Exclude element from view transitions
132
141
 
133
- When you want to exclude an element form view transitions you can add the `noTransition` directive.
142
+ When you want to exclude an element from view transitions, you can add the `noTransition` directive.
134
143
 
135
144
  ```typescript
136
- import { NoTransitionDirective } from 'ngx-easy-view-transitions';
145
+ import {NoTransitionDirective} from 'ngx-easy-view-transitions';
137
146
  ```
138
147
 
139
148
  ```angular2html
@@ -142,10 +151,10 @@ import { NoTransitionDirective } from 'ngx-easy-view-transitions';
142
151
 
143
152
  ### Configure default transition
144
153
 
145
- By default View Transitions API will perform a cross-fade animation on all elements.
154
+ By default, View Transitions API will perform a cross-fade animation on all elements.
146
155
  But you can also provide your own in and out animations by adding the `provideDefaultViewTransition()` provider function.
147
156
 
148
- In the following example the default animation gets disabled:
157
+ In the following example, the default animation gets disabled:
149
158
 
150
159
  ```typescript
151
160
  bootstrapApplication(AppComponent,
@@ -153,14 +162,18 @@ bootstrapApplication(AppComponent,
153
162
  providers: [
154
163
  provideRouter(appRoutes, withViewTransitions()),
155
164
  provideDefaultViewTransition(
156
- { keyframes: DefaultTransitions.none, duration: 0 },
157
- { keyframes: DefaultTransitions.none, duration: 0 }
165
+ {keyframes: DefaultTransitions.none, duration: 0},
166
+ {keyframes: DefaultTransitions.none, duration: 0}
158
167
  )
159
168
  ]
160
169
  }
161
170
  );
162
171
  ```
163
172
 
173
+ ### Troubleshooting
174
+
175
+ If your elements flicker when navigating, try to set the `fillMode` to `forwards`.
176
+
164
177
  ## Development
165
178
 
166
179
  Install dependencies with: `pnpm install`
@@ -174,4 +187,4 @@ Run `pnpm lint` to lint all projects.
174
187
 
175
188
  Run `pnpm build` to build all projects. You can find the output under `/dist`.
176
189
 
177
- Since it's a nx workspace you can use the common nx commands for everything else.
190
+ Since it's a nx workspace, you can use the common nx commands for everything else.