angular-movement 0.0.1 → 0.1.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 +115 -33
- package/fesm2022/angular-movement.mjs +509 -119
- package/fesm2022/angular-movement.mjs.map +1 -1
- package/package.json +3 -2
- package/types/angular-movement.d.ts +95 -16
package/README.md
CHANGED
|
@@ -1,64 +1,146 @@
|
|
|
1
|
-
#
|
|
1
|
+
# angular-movement
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lightweight Angular motion library with declarative directives, presets, spring physics, scroll-driven animation, and presence/stagger orchestration.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Preset-based enter and leave animations
|
|
8
|
+
- Custom keyframes for full control
|
|
9
|
+
- Spring-driven transitions
|
|
10
|
+
- Hover, tap, focus, in-view, and scroll interactions
|
|
11
|
+
- Presence orchestration for exit animations before DOM removal
|
|
12
|
+
- Stagger support for list choreography
|
|
13
|
+
- Works with modern standalone Angular apps
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
8
16
|
|
|
9
17
|
```bash
|
|
10
|
-
|
|
18
|
+
npm install angular-movement
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
Peer dependencies:
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
- @angular/core ^21.2.0
|
|
24
|
+
- @angular/common ^21.2.0
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
Register global config and import directives in your app config.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { ApplicationConfig } from '@angular/core';
|
|
32
|
+
import { provideMovement } from 'angular-movement';
|
|
33
|
+
|
|
34
|
+
export const appConfig: ApplicationConfig = {
|
|
35
|
+
providers: [
|
|
36
|
+
provideMovement({
|
|
37
|
+
duration: 320,
|
|
38
|
+
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
|
|
39
|
+
delay: 0,
|
|
40
|
+
disabled: false,
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
};
|
|
17
44
|
```
|
|
18
45
|
|
|
19
|
-
|
|
46
|
+
```ts
|
|
47
|
+
import { Component } from '@angular/core';
|
|
48
|
+
import { MOVEMENT_DIRECTIVES } from 'angular-movement';
|
|
49
|
+
|
|
50
|
+
@Component({
|
|
51
|
+
selector: 'app-demo',
|
|
52
|
+
standalone: true,
|
|
53
|
+
imports: [...MOVEMENT_DIRECTIVES],
|
|
54
|
+
template: `
|
|
55
|
+
<h2 [move]="'fade-up'">Hello movement</h2>
|
|
56
|
+
<button [moveWhileHover]="{ scale: [1, 1.05] }">Hover me</button>
|
|
57
|
+
`,
|
|
58
|
+
})
|
|
59
|
+
export class DemoComponent {}
|
|
60
|
+
```
|
|
20
61
|
|
|
21
|
-
|
|
62
|
+
## Common Usage
|
|
22
63
|
|
|
23
|
-
|
|
24
|
-
|
|
64
|
+
### Preset animation
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<section [move]="'slide-up'">Content</section>
|
|
25
68
|
```
|
|
26
69
|
|
|
27
|
-
|
|
70
|
+
### Custom keyframes
|
|
28
71
|
|
|
29
|
-
|
|
72
|
+
```html
|
|
73
|
+
<div [move]="{ opacity: [0, 1], y: [20, 0], scale: [0.96, 1] }">Card</div>
|
|
74
|
+
```
|
|
30
75
|
|
|
31
|
-
|
|
76
|
+
### Framer-style API
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<article
|
|
80
|
+
[moveAnimation]="{
|
|
81
|
+
initial: { opacity: 0, y: 24 },
|
|
82
|
+
animate: { opacity: 1, y: 0 },
|
|
83
|
+
exit: { opacity: 0, y: -16 },
|
|
84
|
+
duration: 300
|
|
85
|
+
}"
|
|
86
|
+
>
|
|
87
|
+
Item
|
|
88
|
+
</article>
|
|
89
|
+
```
|
|
32
90
|
|
|
33
|
-
|
|
91
|
+
### Presence for exit transitions
|
|
34
92
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
93
|
+
```html
|
|
94
|
+
<ng-container *movePresence="isOpen">
|
|
95
|
+
<aside [move]="'fade-right'" [moveAnimateLeave]="'fade-left'">Panel</aside>
|
|
96
|
+
</ng-container>
|
|
97
|
+
```
|
|
38
98
|
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
99
|
+
### Staggered lists
|
|
43
100
|
|
|
44
|
-
|
|
101
|
+
```html
|
|
102
|
+
<ul moveStagger [moveStaggerStep]="80">
|
|
103
|
+
<li [move]="'fade-up'">One</li>
|
|
104
|
+
<li [move]="'fade-up'">Two</li>
|
|
105
|
+
<li [move]="'fade-up'">Three</li>
|
|
106
|
+
</ul>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Available Presets
|
|
110
|
+
|
|
111
|
+
fade-up, fade-down, fade-left, fade-right, slide-up, slide-down, slide-left, slide-right, zoom-in, zoom-out, flip-x, flip-y, bounce-in, blur-in, spin, pulse, none
|
|
112
|
+
|
|
113
|
+
## Exports
|
|
114
|
+
|
|
115
|
+
Main entrypoint exports:
|
|
116
|
+
|
|
117
|
+
- MOVEMENT_DIRECTIVES
|
|
118
|
+
- All directives
|
|
119
|
+
- provideMovement
|
|
120
|
+
- Preset and keyframe types
|
|
121
|
+
- Animation engine/control types
|
|
122
|
+
- Tokens for advanced integration
|
|
45
123
|
|
|
46
|
-
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
Build library:
|
|
47
127
|
|
|
48
128
|
```bash
|
|
49
|
-
ng
|
|
129
|
+
ng build movement
|
|
50
130
|
```
|
|
51
131
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
For end-to-end (e2e) testing, run:
|
|
132
|
+
Run library tests:
|
|
55
133
|
|
|
56
134
|
```bash
|
|
57
|
-
ng
|
|
135
|
+
ng test movement
|
|
58
136
|
```
|
|
59
137
|
|
|
60
|
-
|
|
138
|
+
Run coverage:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
ng test movement --coverage --watch=false
|
|
142
|
+
```
|
|
61
143
|
|
|
62
|
-
##
|
|
144
|
+
## License
|
|
63
145
|
|
|
64
|
-
|
|
146
|
+
MIT
|