aos-modern 3.0.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/CHANGELOG.md +101 -0
- package/LICENSE +23 -0
- package/README.md +405 -0
- package/README.zh-CN.md +398 -0
- package/dist/aos.css +1 -0
- package/dist/aos.js +1 -0
- package/dist/react.js +1 -0
- package/dist/vue.js +1 -0
- package/package.json +59 -0
- package/src/js/aos.js +354 -0
- package/src/js/helpers/calculateOffset.js +76 -0
- package/src/js/helpers/detector.js +33 -0
- package/src/js/helpers/elements.js +11 -0
- package/src/js/helpers/handleScroll.js +39 -0
- package/src/js/helpers/prepare.js +11 -0
- package/src/js/libs/observer.js +61 -0
- package/src/js/libs/offset.js +24 -0
- package/src/react/index.js +18 -0
- package/src/sass/_animations.scss +334 -0
- package/src/sass/_core.scss +18 -0
- package/src/sass/_easing.scss +40 -0
- package/src/sass/aos.scss +3 -0
- package/src/vue/index.js +65 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## [3.0.0]
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Added 17 new high-end preset animations inspired by Animate.css (Blur reveals, Skew reveals, Rotate reveals, Springy Back reveals, and Specials like `roll-in` / `jack-in-the-box`).
|
|
7
|
+
- Added native **React** integration (`aos/react`) providing the `useAOS` hook.
|
|
8
|
+
- Added native **Vue** integration (`aos/vue`) providing `AOSPlugin` and a unified `v-aos` directive compatible with Vue 2 and Vue 3.
|
|
9
|
+
- Added the `AOS.destroy()` API to safely clean up all observers and listeners on SPA component lifecycle changes.
|
|
10
|
+
- Added automatic offset refresh after window load to prevent layout shifts.
|
|
11
|
+
- Added safety exception handling for invalid `data-aos-anchor` selectors.
|
|
12
|
+
- Added touch-based mobile/tablet detection support for iPadOS (modern iPads with desktop user agents).
|
|
13
|
+
- Added `.clinerules` and `.cursorrules` specifying Chinese as the default communication language.
|
|
14
|
+
- Added HTML demo pages for core library and framework integrations (React, Vue) under the `docs/` directory.
|
|
15
|
+
- Added comprehensive mock-based unit tests for React `useAOS` hook and Vue `AOSPlugin` custom directive in `test/wrappers.spec.js`.
|
|
16
|
+
- Added a full bilingual localization layer (Chinese and English) with immediate local state initialization to prevent flash-of-untranslated-text (FOUT).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Bilingual Redesign**: Redesigned all demo pages into a premium glassmorphic dashboard theme with CSS Grid, styled monospace indicators, and custom info panels.
|
|
20
|
+
- **IntersectionObserver Rewrite**: Completely rewrote the scroll tracking engine to use native, hardware-accelerated `IntersectionObserver` instead of window scroll event listeners.
|
|
21
|
+
- **Modernized Build Stack**: Upgraded Webpack to v5, Karma to v6, and Sass to modern Dart Sass compiler. Removed PhantomJS.
|
|
22
|
+
- **Zero Runtime Dependencies**: Completely removed legacy packages `classlist-polyfill`, `lodash.debounce`, and `lodash.throttle`, making the runtime footprint extremely lightweight.
|
|
23
|
+
- **Sass Modern API**: Converted all deprecated `@import` rules in Sass to the modern `@use` syntax and configured `sass-loader` to compile via the modern JS compiler API.
|
|
24
|
+
- Updated `package.json` to expose framework subpaths under the `exports` configuration field.
|
|
25
|
+
- Modernized all helper utilities (`elements.js`, `calculateOffset.js`, `detector.js`, `offset.js`) to ES6 standards.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- **UMD Export Ordering**: Corrected entry import order in `webpack.config.js` to place JS files last, ensuring the `AOS` module exports are correctly exposed in browser global environments.
|
|
29
|
+
- Fixed legacy `git://` protocol dependency issues in the test runner.
|
|
30
|
+
- Fixed mock fixture loaders to support synchronous HTML/CSS loading during jasmine specs.
|
|
31
|
+
|
|
32
|
+
## [2.1.1]
|
|
33
|
+
- Clean styles, prefix variables, use !default, separate files for core and animations
|
|
34
|
+
|
|
35
|
+
## [2.1.0]
|
|
36
|
+
- Attach event listener to window instead of document for event `load`
|
|
37
|
+
|
|
38
|
+
## [2.0.4]
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Fix device detector (tablet setting)
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
- Disable AOS on not supported browsers (<= IE9)
|
|
45
|
+
- Clean code around `disable` option
|
|
46
|
+
- Rewrite device detector using ES6 Class
|
|
47
|
+
|
|
48
|
+
## [2.0.3]
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- Add `transform-object-assign` plugin for babel, so Object.assign works in IE
|
|
52
|
+
|
|
53
|
+
## [2.0.2]
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- Fix include in arrays, so it works in IE
|
|
57
|
+
|
|
58
|
+
## [2.0.1]
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
- Add easings, after they were accidentaly ignored
|
|
62
|
+
|
|
63
|
+
## [2.0.0]
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
- Add new CHANGELOG
|
|
67
|
+
- Add contribution guide
|
|
68
|
+
- Add emojis in README
|
|
69
|
+
- Add map file for styles
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- Make `data-aos` attributes the default and only proper ones
|
|
73
|
+
- Use maps and loops in Sass
|
|
74
|
+
- Replace gulp with webpack
|
|
75
|
+
- Rewrite Karma config and use webpack to bundle tests
|
|
76
|
+
- Upgrade to ES6
|
|
77
|
+
- Update documentation
|
|
78
|
+
- Update demos
|
|
79
|
+
|
|
80
|
+
### Removed
|
|
81
|
+
- Remove `aos` attributes
|
|
82
|
+
- Remove gulp from build tools
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
- Improve animations performance
|
|
86
|
+
- Fix styles loading in tests
|
|
87
|
+
|
|
88
|
+
## [1.2.2]
|
|
89
|
+
### Fixed
|
|
90
|
+
- Fix AOS refreshing on asynchronously loaded elements
|
|
91
|
+
|
|
92
|
+
## [1.2.1]
|
|
93
|
+
### Fixed
|
|
94
|
+
- Fix problem with using AOS as node package by setting main file in package.json
|
|
95
|
+
|
|
96
|
+
## [1.2.0]
|
|
97
|
+
### Added
|
|
98
|
+
- Add compatibility with module systems
|
|
99
|
+
|
|
100
|
+
### Fixed
|
|
101
|
+
- Fix AOS initializing when DOM is already loaded
|
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Michał Sajnóg
|
|
4
|
+
Copyright (c) 2026 galun <gabulaideu@gmail.com>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
[](https://gabulaideu.github.io/aos/)
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/aos-modern)
|
|
4
|
+
[](https://npmjs.org/package/aos-modern)
|
|
5
|
+
[](https://travis-ci.org/michalsnik/aos)
|
|
6
|
+
[](https://gitter.im/michalsnik/aos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
7
|
+
|
|
8
|
+
[](https://twitter.com/michalsnik) [](https://twitter.com/home?status=AOS%20-%20Animate%20on%20Scroll%20library%0Ahttps%3A//github.com/michalsnik/aos)
|
|
9
|
+
|
|
10
|
+
Small library to animate elements on your page as you scroll.
|
|
11
|
+
|
|
12
|
+
You may say it's like WOWJS, yeah - you're right, effect is similar to WOWJS, but I had a different idea how to make such a plugin, so here it is. CSS3 driven scroll animation library.
|
|
13
|
+
|
|
14
|
+
AOS allows you to animate elements as you scroll down, and up.
|
|
15
|
+
If you scroll back to top, elements will animate to it's previous state and are ready to animate again if you scroll down.
|
|
16
|
+
|
|
17
|
+
👉 To get a better understanding how this actually works, I encourage you to check [my post on CSS-tricks](https://css-tricks.com/aos-css-driven-scroll-animation-library/).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### 🚀 [Demo](https://gabulaideu.github.io/aos/)
|
|
22
|
+
|
|
23
|
+
### 🌟 Codepen Examples
|
|
24
|
+
- [Different build in animations](http://codepen.io/michalsnik/pen/WxNdvq)
|
|
25
|
+
- [With anchor setting in use](http://codepen.io/michalsnik/pen/jrOYVO)
|
|
26
|
+
- [With anchor-placement and different easing](http://codepen.io/michalsnik/pen/EyxoNm)
|
|
27
|
+
- [With simple custom animations](http://codepen.io/michalsnik/pen/WxvNvE)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ❗ Attention
|
|
32
|
+
From version `2.0.0` attributes `aos` are no longer supported, always use `data-aos`.
|
|
33
|
+
|
|
34
|
+
## ⚙ Setup
|
|
35
|
+
|
|
36
|
+
### Install AOS
|
|
37
|
+
|
|
38
|
+
- Using `npm` or `yarn`
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install aos-modern --save
|
|
42
|
+
# or
|
|
43
|
+
yarn add aos-modern
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Direct download -> [click here](https://github.com/gabulaideu/aos/archive/master.zip)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Link styles
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<link rel="stylesheet" href="node_modules/aos-modern/dist/aos.css" />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Add scripts
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<script src="node_modules/aos-modern/dist/aos.js"></script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
AOS from version `1.2.0` is available as UMD module, so you can use it as AMD, Global, Node or ES6 module.
|
|
62
|
+
|
|
63
|
+
### Init AOS
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
<script>
|
|
67
|
+
AOS.init();
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 🤔 How to use it?
|
|
72
|
+
|
|
73
|
+
### Basic usage
|
|
74
|
+
|
|
75
|
+
All you have to do is to add `data-aos` attribute to html element, like so:
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<div data-aos="animation_name">
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Script will trigger "animation_name" animation on this element, if you scroll to it.
|
|
82
|
+
|
|
83
|
+
[Down below](https://github.com/gabulaideu/aos#-animations) is a list of all available animations for now :)
|
|
84
|
+
|
|
85
|
+
### 🔥 Advanced settings
|
|
86
|
+
|
|
87
|
+
These settings can be set both on certain elements, or as default while initializing script (in options object without `data-` part).
|
|
88
|
+
|
|
89
|
+
| Attribute | Description | Example value | Default value |
|
|
90
|
+
|---------------------------|-------------|---------------|---------|
|
|
91
|
+
| *`data-aos-offset`* | Change offset to trigger animations sooner or later (px) | 200 | 120 |
|
|
92
|
+
| *`data-aos-duration`* | *Duration of animation (ms) | 600 | 400 |
|
|
93
|
+
| *`data-aos-easing`* | Choose timing function to ease elements in different ways | ease-in-sine | ease |
|
|
94
|
+
| *`data-aos-delay`* | Delay animation (ms) | 300 | 0 |
|
|
95
|
+
| *`data-aos-anchor`* | Anchor element, whose offset will be counted to trigger animation instead of actual elements offset | #selector | null |
|
|
96
|
+
| *`data-aos-anchor-placement`* | Anchor placement - which one position of element on the screen should trigger animation | top-center | top-bottom |
|
|
97
|
+
| *`data-aos-once`* | Choose wheter animation should fire once, or every time you scroll up/down to element | true | false |
|
|
98
|
+
|
|
99
|
+
*Duration accept values from 50 to 3000, with step 50ms, it's because duration of animation is handled by css, and to not make css longer than it is already I created implementations only in this range. I think this should be good for almost all cases.
|
|
100
|
+
|
|
101
|
+
If not, you may write simple CSS on your page that will add another duration option value available, for example:
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
body[data-aos-duration='4000'] [data-aos], [data-aos][data-aos][data-aos-duration='4000']{
|
|
105
|
+
transition-duration: 4000ms;
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This code will add 4000ms duration available for you to set on AOS elements, or to set as global duration while initializing AOS script.
|
|
110
|
+
|
|
111
|
+
Notice that double `[data-aos][data-aos]` - it's not a mistake, it is a trick, to make individual settings more important than global, without need to write ugly "!important" there :)
|
|
112
|
+
|
|
113
|
+
`data-aos-anchor-placement` - You can set different placement option on each element, the principle is pretty simple, each anchor-placement option contains two words i.e. `top-center`. This means that animation will be triggered when `top` of element will reach `center` of the window.
|
|
114
|
+
`bottom-top` means that animation will be triggered when `bottom` of an element reach `top` of the window, and so on.
|
|
115
|
+
Down below you can find list of all anchor-placement options.
|
|
116
|
+
|
|
117
|
+
#### Examples:
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<div data-aos="fade-zoom-in" data-aos-offset="200" data-aos-easing="ease-in-sine" data-aos-duration="600">
|
|
121
|
+
```
|
|
122
|
+
```html
|
|
123
|
+
<div data-aos="flip-left" data-aos-delay="100" data-aos-anchor=".example-selector">
|
|
124
|
+
```
|
|
125
|
+
```html
|
|
126
|
+
<div data-aos="fade-up" data-aos-anchor-placement="top-center">
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
#### API
|
|
131
|
+
|
|
132
|
+
AOS object is exposed as a global variable, for now there are four methods available:
|
|
133
|
+
|
|
134
|
+
* `init` - initialize AOS
|
|
135
|
+
* `refresh` - recalculate all offsets and positions of elements (called on window resize)
|
|
136
|
+
* `refreshHard` - reinit array with AOS elements and trigger `refresh` (called on DOM changes that are related to `aos` elements)
|
|
137
|
+
* `destroy` - cleanup all scroll observers, mutation observers, and event listeners (ideal for SPA router/lifecycle cleanups)
|
|
138
|
+
|
|
139
|
+
Example execution:
|
|
140
|
+
```javascript
|
|
141
|
+
AOS.refresh();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
By default AOS is watching for DOM changes and if there are any new elements loaded asynchronously or when something is removed from DOM it calls `refreshHard` automatically. In browsers that don't support `MutationObserver` like IE you might need to call `AOS.refreshHard()` by yourself.
|
|
145
|
+
|
|
146
|
+
`refresh` method is called on window resize and so on, as it doesn't require to build new store with AOS elements and should be as light as possible.
|
|
147
|
+
|
|
148
|
+
### Global settings
|
|
149
|
+
|
|
150
|
+
If you don't want to change setting for each element separately, you can change it globally.
|
|
151
|
+
|
|
152
|
+
To do this, pass options object to `init()` function, like so:
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
<script>
|
|
156
|
+
AOS.init({
|
|
157
|
+
offset: 200,
|
|
158
|
+
duration: 600,
|
|
159
|
+
easing: 'ease-in-sine',
|
|
160
|
+
delay: 100,
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Additional configuration
|
|
166
|
+
|
|
167
|
+
These settings can be set only in options object while initializing AOS.
|
|
168
|
+
|
|
169
|
+
| Setting | Description | Example value | Default value |
|
|
170
|
+
|---------------------------|-------------|---------------|---------|
|
|
171
|
+
| *`disable`* | Condition when AOS should be disabled | mobile | false |
|
|
172
|
+
| *`startEvent`* | Name of event, on which AOS should be initialized | exampleEvent | DOMContentLoaded |
|
|
173
|
+
|
|
174
|
+
##### Disabling AOS
|
|
175
|
+
|
|
176
|
+
If you want to disable AOS on certain device or under any statement you can set `disable` option. Like so:
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
<script>
|
|
180
|
+
AOS.init({
|
|
181
|
+
disable: 'mobile'
|
|
182
|
+
});
|
|
183
|
+
</script>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
There are several options that you can use to fit AOS perfectly into your project, you can pass one of three device types:
|
|
187
|
+
`mobile` (phones and tablets), `phone` or `tablet`. This will disable AOS on those certains devices. But if you want make your own condition, simple type your statement instead of device type name:
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
disable: window.innerWidth < 1024
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
There is also posibility to pass a `function`, which should at the end return `true` or `false`:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
disable: function () {
|
|
197
|
+
var maxWidth = 1024;
|
|
198
|
+
return window.innerWidth < maxWidth;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
##### Start event
|
|
203
|
+
|
|
204
|
+
If you don't want to initialize AOS on `DOMContentLoaded` event, you can pass your own event name and trigger it whenever you want. AOS is listening for this event on `document` element.
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
<script>
|
|
208
|
+
AOS.init({
|
|
209
|
+
startEvent: 'someCoolEvent'
|
|
210
|
+
});
|
|
211
|
+
</script>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Important note:** If you set `startEvent: 'load'` it will add event listener on `window` instead of `document`.
|
|
215
|
+
### 🖥 Local Demos
|
|
216
|
+
|
|
217
|
+
AOS Modern comes with ready-to-run HTML demo pages for both the core library and the framework integrations, demonstrating advanced animations and component lifecycles.
|
|
218
|
+
|
|
219
|
+
To run the demos locally:
|
|
220
|
+
1. Clone this repository
|
|
221
|
+
2. Install dependencies and start the development server:
|
|
222
|
+
```bash
|
|
223
|
+
yarn install
|
|
224
|
+
yarn dev
|
|
225
|
+
```
|
|
226
|
+
3. Open the following pages in your browser:
|
|
227
|
+
- **Official Interactive Demo Portal**: [http://localhost:8080/](http://localhost:8080/)
|
|
228
|
+
- **Core Library (Static)**: [http://localhost:8080/simple.html](http://localhost:8080/simple.html)
|
|
229
|
+
- **Core Library (Async DOM Mutation)**: [http://localhost:8080/async.html](http://localhost:8080/async.html)
|
|
230
|
+
- **React (useAOS Hook & Lifecycle)**: [http://localhost:8080/react.html](http://localhost:8080/react.html)
|
|
231
|
+
- **Vue (v-aos Custom Directive)**: [http://localhost:8080/vue.html](http://localhost:8080/vue.html)
|
|
232
|
+
|
|
233
|
+
### 📦 Framework Integrations
|
|
234
|
+
|
|
235
|
+
AOS provides native integrations for modern frontend frameworks (React, Vue) out-of-the-box. You can import them directly from subpaths.
|
|
236
|
+
|
|
237
|
+
#### ⚛️ React
|
|
238
|
+
|
|
239
|
+
AOS exposes a custom hook `useAOS` to handle initialization and component cleanup.
|
|
240
|
+
|
|
241
|
+
```javascript
|
|
242
|
+
import React from 'react';
|
|
243
|
+
import { useAOS } from 'aos/react';
|
|
244
|
+
|
|
245
|
+
function MyComponent() {
|
|
246
|
+
useAOS({
|
|
247
|
+
duration: 1000,
|
|
248
|
+
once: true
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<div data-aos="fade-up">
|
|
253
|
+
Animate me!
|
|
254
|
+
</div>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### 💚 Vue
|
|
260
|
+
|
|
261
|
+
We support both Vue 2 and Vue 3 using a unified Vue Plugin and a custom directive `v-aos`.
|
|
262
|
+
|
|
263
|
+
```javascript
|
|
264
|
+
import { createApp } from 'vue';
|
|
265
|
+
import { AOSPlugin } from 'aos/vue';
|
|
266
|
+
import App from './App.vue';
|
|
267
|
+
|
|
268
|
+
const app = createApp(App);
|
|
269
|
+
|
|
270
|
+
// Register AOS Plugin
|
|
271
|
+
app.use(AOSPlugin, {
|
|
272
|
+
duration: 800,
|
|
273
|
+
once: false
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
app.mount('#app');
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Then use the `v-aos` directive in your components:
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<!-- Basic string argument -->
|
|
283
|
+
<div v-aos="'fade-up'"></div>
|
|
284
|
+
|
|
285
|
+
<!-- Binding argument -->
|
|
286
|
+
<div v-aos:fade-down></div>
|
|
287
|
+
|
|
288
|
+
<!-- Object options configuration -->
|
|
289
|
+
<div v-aos="{ animation: 'zoom-in', delay: 200, duration: 600 }"></div>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
### 👻 Animations
|
|
294
|
+
|
|
295
|
+
There are serveral predefined animations you can use already:
|
|
296
|
+
|
|
297
|
+
* Fade animations:
|
|
298
|
+
* fade
|
|
299
|
+
* fade-up
|
|
300
|
+
* fade-down
|
|
301
|
+
* fade-left
|
|
302
|
+
* fade-right
|
|
303
|
+
* fade-up-right
|
|
304
|
+
* fade-up-left
|
|
305
|
+
* fade-down-right
|
|
306
|
+
* fade-down-left
|
|
307
|
+
|
|
308
|
+
* Flip animations:
|
|
309
|
+
* flip-up
|
|
310
|
+
* flip-down
|
|
311
|
+
* flip-left
|
|
312
|
+
* flip-right
|
|
313
|
+
|
|
314
|
+
* Slide animations:
|
|
315
|
+
* slide-up
|
|
316
|
+
* slide-down
|
|
317
|
+
* slide-left
|
|
318
|
+
* slide-right
|
|
319
|
+
|
|
320
|
+
* Zoom animations:
|
|
321
|
+
* zoom-in
|
|
322
|
+
* zoom-in-up
|
|
323
|
+
* zoom-in-down
|
|
324
|
+
* zoom-in-left
|
|
325
|
+
* zoom-in-right
|
|
326
|
+
* zoom-out
|
|
327
|
+
* zoom-out-up
|
|
328
|
+
* zoom-out-down
|
|
329
|
+
* zoom-out-left
|
|
330
|
+
* zoom-out-right
|
|
331
|
+
|
|
332
|
+
* Blur animations:
|
|
333
|
+
* blur-in
|
|
334
|
+
* blur-in-up
|
|
335
|
+
* blur-in-down
|
|
336
|
+
* blur-in-left
|
|
337
|
+
* blur-in-right
|
|
338
|
+
|
|
339
|
+
* Skew animations:
|
|
340
|
+
* skew-up
|
|
341
|
+
* skew-down
|
|
342
|
+
|
|
343
|
+
* Rotate animations:
|
|
344
|
+
* rotate-in
|
|
345
|
+
* rotate-in-up-left
|
|
346
|
+
* rotate-in-up-right
|
|
347
|
+
* rotate-in-down-left
|
|
348
|
+
* rotate-in-down-right
|
|
349
|
+
|
|
350
|
+
* Back animations:
|
|
351
|
+
* back-in
|
|
352
|
+
* back-in-up
|
|
353
|
+
* back-in-down
|
|
354
|
+
* back-in-left
|
|
355
|
+
* back-in-right
|
|
356
|
+
|
|
357
|
+
* Specials:
|
|
358
|
+
* roll-in
|
|
359
|
+
* jack-in-the-box
|
|
360
|
+
|
|
361
|
+
### Anchor placement:
|
|
362
|
+
|
|
363
|
+
* top-bottom
|
|
364
|
+
* top-center
|
|
365
|
+
* top-top
|
|
366
|
+
* center-bottom
|
|
367
|
+
* center-center
|
|
368
|
+
* center-top
|
|
369
|
+
* bottom-bottom
|
|
370
|
+
* bottom-center
|
|
371
|
+
* bottom-top
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
### Easing functions:
|
|
375
|
+
|
|
376
|
+
You can choose one of these timing function to animate elements nicely:
|
|
377
|
+
|
|
378
|
+
* linear
|
|
379
|
+
* ease
|
|
380
|
+
* ease-in
|
|
381
|
+
* ease-out
|
|
382
|
+
* ease-in-out
|
|
383
|
+
* ease-in-back
|
|
384
|
+
* ease-out-back
|
|
385
|
+
* ease-in-out-back
|
|
386
|
+
* ease-in-sine
|
|
387
|
+
* ease-out-sine
|
|
388
|
+
* ease-in-out-sine
|
|
389
|
+
* ease-in-quad
|
|
390
|
+
* ease-out-quad
|
|
391
|
+
* ease-in-out-quad
|
|
392
|
+
* ease-in-cubic
|
|
393
|
+
* ease-out-cubic
|
|
394
|
+
* ease-in-out-cubic
|
|
395
|
+
* ease-in-quart
|
|
396
|
+
* ease-out-quart
|
|
397
|
+
* ease-in-out-quart
|
|
398
|
+
|
|
399
|
+
## ✌️ [Contributing](CONTRIBUTING.md)
|
|
400
|
+
|
|
401
|
+
## 📝 [Changelog](CHANGELOG.md)
|
|
402
|
+
|
|
403
|
+
## ❔Questions
|
|
404
|
+
|
|
405
|
+
If you have any questions, ideas or whatsoever, please check [AOS contribution guide](CONTRIBUTING.md) and don't hesitate to create new issues.
|