mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
a525b42537
closes #126
45 lines
1016 B
Markdown
45 lines
1016 B
Markdown
# 🦉 Animations 🦉
|
|
|
|
|
|
Animation is a complex topic. There are many different use cases, and many
|
|
solutions and technologies. Owl only supports some basic use cases.
|
|
|
|
## Simple CSS effects
|
|
|
|
Sometimes, using pure CSS is enough. For these use cases, Owl is not really
|
|
necessary: it just needs to render a DOM element with a specific class. For
|
|
example:
|
|
|
|
|
|
```xml
|
|
<a class="btn flash" t-on-click="doSomething">Click</a>
|
|
```
|
|
|
|
with the following CSS:
|
|
|
|
```css
|
|
btn {
|
|
background-color: gray;
|
|
}
|
|
|
|
.flash {
|
|
transition: background 0.5s;
|
|
}
|
|
|
|
.flash:active {
|
|
background-color: #41454a;
|
|
transition: background 0s;
|
|
}
|
|
```
|
|
|
|
will produce a nice flash effect whenever the user click (or activate with the
|
|
keyboard) the button.
|
|
|
|
## CSS Transitions (single element)
|
|
|
|
A more complex situation occurs when we want to transition an element in or out
|
|
of the page. For example, we may want a fade-in and fade-out effect.
|
|
|
|
The `t-transition` directive is here to help us (see [QWeb documentation](qweb.md#t-transition-directive)).
|
|
|