pagewave 1.0.4 → 1.0.5
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 +351 -331
- package/dist/KeyFramePreset.css +55 -0
- package/{OverlayPreset.css → dist/OverlayPreset.css} +49 -14
- package/dist/index.d.mts +126 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +573 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +537 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +28 -8
- package/KeyFramePreset.css +0 -20
- package/sw.js +0 -40
- package/transition.js +0 -518
package/README.md
CHANGED
|
@@ -1,331 +1,351 @@
|
|
|
1
|
-
|
|
2
|
-
# PageWave
|
|
3
|
-
|
|
4
|
-
An NPM Package for implementing page transitions in both SSR and CSR apps
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
-
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
//This is the class
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
//This is the
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
//Whether the
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
//
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
//
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
1
|
+
|
|
2
|
+
# PageWave
|
|
3
|
+
|
|
4
|
+
An NPM Package for implementing page transitions in both SSR and CSR apps
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install pagewave with npm
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install pagewave
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Built-in animations
|
|
19
|
+
- Hooks
|
|
20
|
+
- Doesn't touch history or use push state, allowing for you to use it with routers like sveltekit
|
|
21
|
+
- Manual page transition animations can be run to avoid conflicts with any frameworks
|
|
22
|
+
- Customizable ids for divs to avoid conflict with elements in your body
|
|
23
|
+
- Allows for custom animations based on class name of link
|
|
24
|
+
- Preset transition classes to get up and running quickly
|
|
25
|
+
- Highly customizable transition options
|
|
26
|
+
- Extendable class system to create custom transition styles
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## High Level Explanation
|
|
30
|
+
|
|
31
|
+
This package involves allows a user to set up certain routes with names and have those routes triggered either by clicking on a link, loading onto a page, or manually.
|
|
32
|
+
|
|
33
|
+
Utilize transtion classes premade or custom built to handle it.
|
|
34
|
+
|
|
35
|
+
## Getting started
|
|
36
|
+
|
|
37
|
+
At its core,
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { PageWave, KeyFramePreset, StyleTransition, type KeyFrameType } from 'pagewave';
|
|
41
|
+
import "pagewave/KeyFramePreset.css";
|
|
42
|
+
|
|
43
|
+
let keyFrameType: KeyFrameType = "fadetoright";
|
|
44
|
+
|
|
45
|
+
let fadeToRightTransition = new KeyFrameCustom(
|
|
46
|
+
keyFrameType, 250, "ease-in-out"
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
let defaultTransition = new StyleTransition(
|
|
50
|
+
"opacity", 250, "1", "0"
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const pw: PageWave = new PageWave(
|
|
54
|
+
{
|
|
55
|
+
"fade": fadeToRightTransition
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// The following code should be contained within a client function like Sveltekit onMount or React useLayoutEffect if being done in SSR
|
|
60
|
+
|
|
61
|
+
// Setups the transition to occur when loading onto page, with a default transition provided
|
|
62
|
+
pw.EndPoint(defaultTransition);
|
|
63
|
+
|
|
64
|
+
// Setups the transition to occur when a link is clicked, with a default transition provided
|
|
65
|
+
pw.SendPoint(defaultTransition);
|
|
66
|
+
|
|
67
|
+
// Called to start the endpoint
|
|
68
|
+
pw.CallEndPoint();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In this code, there are a few points to note:
|
|
72
|
+
- The arguments in PageWave represent routes that are used by EndPoint and SendPoint
|
|
73
|
+
- For SendPoint, if a link has the class "fade", it will run the fade animation when clicked, and then go to the link. It will also save in sessionStorage the name "fade" under animationType
|
|
74
|
+
- This session storage is used in EndPoint as it looks for a route matching the saved value under animationType. In this code, it would look for fade and play that transition.
|
|
75
|
+
- Just because two pages may have "fade" defined doesn't mean that they have to play the same animation
|
|
76
|
+
- CallEndPoint is utilized in cases where the base event "DOMContentLoaded" isn't called on every page (like in SSR where the layout stays constant)
|
|
77
|
+
|
|
78
|
+
### Setting up an animation
|
|
79
|
+
|
|
80
|
+
Tag the element that encapsulates the content with an id of 'main-content'
|
|
81
|
+
|
|
82
|
+
If you can't do that, change the parameter name.
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<script>
|
|
86
|
+
import { PageWave, KeyFramePreset, StyleTransition, type KeyFrameType } from 'pagewave'
|
|
87
|
+
import "pagewave/OverlayPreset.css";
|
|
88
|
+
let keyFrameType: OverlayType = "bubble";
|
|
89
|
+
|
|
90
|
+
let bubbleTransition = new OverlayPreset(
|
|
91
|
+
overlayType.bubble, 500, "#293241"
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
let defaultTransition = new StyleTransition(
|
|
95
|
+
"opacity", 250, "1", "0"
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const pw: PageWave = new PageWave(
|
|
99
|
+
{
|
|
100
|
+
"pagewave-bubble": bubbleTransition
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
// These are options. This option is unnecessary as it defaults to "main-content", but showcasing you can change it
|
|
104
|
+
mainContentIdName: "main-content"
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// The following code should be contained within a client function like Sveltekit onMount or React useLayoutEffect if being done in SSR
|
|
109
|
+
|
|
110
|
+
// Combines Endpoint and Sendpoint if you need individual control
|
|
111
|
+
pw.ListenForChange(defaultTransition);
|
|
112
|
+
pw.CallEndPoint();
|
|
113
|
+
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<!--The area that you want to transition must be marked with id="main-content"-->
|
|
117
|
+
<div id="main-content">
|
|
118
|
+
<h1>This is my page</h1>
|
|
119
|
+
<!-- This link transitions with the pagewave-bubble transition-->
|
|
120
|
+
<a href="..." class="pagewave-bubble">Click me to transition!</a>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Working with SSR
|
|
126
|
+
|
|
127
|
+
Because of the nature of SSR, a few changes have to be made:
|
|
128
|
+
- The Send and End Points function must be run in load functions as they make reference to the window for changing the link and dispatching events
|
|
129
|
+
- You need to change the goto Function for SendPoint. Do this by `SendPoint(defaultTransition, () => {/* Function */})`
|
|
130
|
+
- Links may need to prevent default. The SendPoint function does this automatically, but it may need to be done manually
|
|
131
|
+
|
|
132
|
+
## Other Cool Features
|
|
133
|
+
|
|
134
|
+
### Custom Keyframe Transitions
|
|
135
|
+
|
|
136
|
+
This will create an animation style, that when called:
|
|
137
|
+
|
|
138
|
+
Moves h1 and p elements to the left
|
|
139
|
+
|
|
140
|
+
Moves h2 and elements with 'moving' class to the right
|
|
141
|
+
|
|
142
|
+
This is over 1000ms, at a 'linear' pace, and fades everything
|
|
143
|
+
|
|
144
|
+
Essentially you can specify specific transitions for certain classes and a global transition for everything
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
let multiElementAnimation =l new MultiElementAnimation(
|
|
151
|
+
{
|
|
152
|
+
"h1": "move",
|
|
153
|
+
"p": "move",
|
|
154
|
+
"h2": "inverseMove",
|
|
155
|
+
".moving": "inverseMove",
|
|
156
|
+
}, 1000, "linear", "fadeAll"
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
pw.ListenForChange(multiElementAnimation);
|
|
160
|
+
|
|
161
|
+
...
|
|
162
|
+
|
|
163
|
+
<style>
|
|
164
|
+
|
|
165
|
+
@keyframes move {
|
|
166
|
+
from{
|
|
167
|
+
transform: translate(0px, 0px);
|
|
168
|
+
color: black;
|
|
169
|
+
opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
to{
|
|
172
|
+
transform: translate(-200px, 0px);
|
|
173
|
+
opacity: 0;
|
|
174
|
+
color: white;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
@keyframes inverseMove {
|
|
179
|
+
from{
|
|
180
|
+
transform: translate(0, 0px);
|
|
181
|
+
opacity: 1;
|
|
182
|
+
}
|
|
183
|
+
to{
|
|
184
|
+
transform: translate(200px, 0px);
|
|
185
|
+
opacity: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
@keyframes fadeAll {
|
|
190
|
+
from{
|
|
191
|
+
opacity: 1;
|
|
192
|
+
}
|
|
193
|
+
to{
|
|
194
|
+
opacity: 0;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
198
|
+
|
|
199
|
+
...
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Custom Overlay Transitions
|
|
204
|
+
|
|
205
|
+
There are a few kinds of Custom Overlays
|
|
206
|
+
|
|
207
|
+
OverlayCustom allows you to define which many different overlays and customize them. They will take the key as the class name (if you want to find it) and the value as the animation.
|
|
208
|
+
|
|
209
|
+
After the object of divs, there is
|
|
210
|
+
- duration
|
|
211
|
+
- color of divs
|
|
212
|
+
- timing
|
|
213
|
+
- animation to play while Overlay Animation plays
|
|
214
|
+
|
|
215
|
+
OverlayStyled is similar, except for two parts:
|
|
216
|
+
- The object is now multi level, where the key is still the class name, but the value is object consisting of the animation name and the styles to be applied to the specific div.
|
|
217
|
+
- After all the parameters, there is a new parameter that allows you to change the style of the blocker element. This is useful in cases like the example where since the div is a gradient, the blocker should look like that to be seamless
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
let customOverlay = new OverlayCustom(
|
|
221
|
+
{
|
|
222
|
+
"first": "rise",
|
|
223
|
+
"second": "fall",
|
|
224
|
+
"third": "slide",
|
|
225
|
+
"fourth": "inverseSlide",
|
|
226
|
+
}, 3000, "#293241", "ease-in-out", null
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
let styledOverlay = new OverlayStyled(
|
|
230
|
+
{
|
|
231
|
+
"first": {
|
|
232
|
+
animationName: "rise",
|
|
233
|
+
cssDesign: {
|
|
234
|
+
"background": "linear-gradient(90deg,rgba(42, 123, 155, 1) 0%, rgba(87, 199, 133, 1) 50%, rgba(237, 221, 83, 1) 100%)"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
}, 3000, "#293241", "ease-in-out", null, {
|
|
238
|
+
"background": "linear-gradient(90deg,rgba(42, 123, 155, 1) 0%, rgba(87, 199, 133, 1) 50%, rgba(237, 221, 83, 1) 100%)"
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
#### Manual Transitions
|
|
245
|
+
|
|
246
|
+
You can do transitions manually through the ```AnimatePageTransition(style)``` method which takes a Transitionstyle as a parameter
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
### Custom Link function
|
|
250
|
+
|
|
251
|
+
By default, this package uses a default function of ```window.location = link;``` for changing links. However, this can be customized in either ```SendPoint() or ListenForChange()```
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
let defaultAnimation = ...
|
|
255
|
+
let linkFunction = (link) => {
|
|
256
|
+
console.log(link);
|
|
257
|
+
window.location = link;
|
|
258
|
+
}
|
|
259
|
+
SendPoint(defaultAnimation, linkFunction);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
This is useful in SSR when the link change function is different from the default one.
|
|
263
|
+
|
|
264
|
+
### Events
|
|
265
|
+
|
|
266
|
+
There are many events that can be listened to to call certain code.
|
|
267
|
+
|
|
268
|
+
- animateSF - animation start, forward direction
|
|
269
|
+
- animateSR - animation start, reverse direction
|
|
270
|
+
- animateEF - animation end, forward direction
|
|
271
|
+
- animateER - animation end, reverse direction
|
|
272
|
+
- animateSSP - start of Send Point listening (when a link is clicked)
|
|
273
|
+
- animateESP - end of Send Point listen (when the animation is handled)
|
|
274
|
+
- animateSEP - start of end point listen (when the load event is dispatched)
|
|
275
|
+
- animateEEP - end of end point (when the page is revealed after an animation)
|
|
276
|
+
- animateEPNA - end point no animation played (when the page is revealed but no animation was played)
|
|
277
|
+
|
|
278
|
+
Listen by using window.addEventListener("...", (e) => {
|
|
279
|
+
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
### This program has optional parameters:
|
|
283
|
+
|
|
284
|
+
#### Optional Parameter Name : Default Value
|
|
285
|
+
|
|
286
|
+
```javascript
|
|
287
|
+
//This is the class for the content that the transition will affect/cover
|
|
288
|
+
mainContentIdName: "main-content"
|
|
289
|
+
|
|
290
|
+
//This is the delay between the page loading and the page beginning the animation
|
|
291
|
+
pageAnimationDelay: 100,
|
|
292
|
+
|
|
293
|
+
//Whether the transition should run when the page is reloaded
|
|
294
|
+
//Sometimes needs to be enabled in SSR because of how they treat going from one page to another as reloading
|
|
295
|
+
runAnimationOnPageReload: false,
|
|
296
|
+
|
|
297
|
+
//Whether the transition should run when a link goes to a different page
|
|
298
|
+
runAnimationOnCrossSite: false,
|
|
299
|
+
|
|
300
|
+
//The delay between the animation playing and the page revealing
|
|
301
|
+
pageRevealDelay: 0,
|
|
302
|
+
|
|
303
|
+
//Whether the page should be left after animation
|
|
304
|
+
leavePageOnLink: true,
|
|
305
|
+
|
|
306
|
+
//What the ID of the element that blocks the page is
|
|
307
|
+
pageBlockerId: "pageBlocker",
|
|
308
|
+
|
|
309
|
+
//What class should be added to links to not transition
|
|
310
|
+
classToIgnoreLink: "ignore-click",
|
|
311
|
+
|
|
312
|
+
//Whether ignored links should animate
|
|
313
|
+
animateIgnoredLinks: false,
|
|
314
|
+
|
|
315
|
+
//Whether links to the same page should animate
|
|
316
|
+
animateSelfLink: true,
|
|
317
|
+
|
|
318
|
+
//The event that is checked to see that the page is loaded and what CallEndPoint dispatches
|
|
319
|
+
loadEvent: "DOMContentLoaded",
|
|
320
|
+
|
|
321
|
+
// When true, it will ignore transitioning on a link if no animation is found in the class list
|
|
322
|
+
// Otherwise, it will transition every time unless explicitly told to ignore
|
|
323
|
+
preferIgnore: false
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Extending with Custom Transition classes
|
|
327
|
+
PageWave provides many custom classes to create beautiful transitions:
|
|
328
|
+
- **KeyFrameCustom** for a custom transition animation on main-content
|
|
329
|
+
- **KeyFramePreset** to utilize premade animations for getting started quickly
|
|
330
|
+
- **MultiElementAnimation** to animate multiple elements and have more fine grained control
|
|
331
|
+
- **OverlayCustom** for a custom overlay animation
|
|
332
|
+
- **OverlayPreset** to utilize premade overlay animations for getting started quickly
|
|
333
|
+
- **OverlayStyled** to have complete control over how an overlay animation looks
|
|
334
|
+
- **StyleTransition** to utilize the transition css property to animate a single property
|
|
335
|
+
|
|
336
|
+
However, if you need to do something not listed here, the class system can be easily extended.
|
|
337
|
+
|
|
338
|
+
To do so, you must implement the TransitionStyleInterface which requires a few parts to be defined:
|
|
339
|
+
- duration: number (how long the animation lasts)
|
|
340
|
+
- timing: TimingType (how the animation moves)
|
|
341
|
+
- handle(direction: DirectionType, mainElement: HTMLElement) : void (runs the actual transition animation)
|
|
342
|
+
- hidePage(options: OptionsType) : void (hides the page either before or after animation)
|
|
343
|
+
- revealPage(options: OptionsType): void (reveals the page once animation needs to be shown)
|
|
344
|
+
|
|
345
|
+
PageWave does the rest of the work on using these functions to create seamless transitions.
|
|
346
|
+
|
|
347
|
+
If you want to use a preexisting implementation, you can use KeyFrameBase or OverlayBase which power many of their respective child classes.
|
|
348
|
+
|
|
349
|
+
## Supporting
|
|
350
|
+
|
|
351
|
+
If you find this project helpful, considering starring ⭐ it. I would greatly appreciate it! :)
|