Files
odoo_source/addons/web/static/src/less/animation.less
T
Dharmraj Jhala 4330ea0267 [ADD] web, *: add rainbowification
This commit introduces the 'rainbowification' feature to the web client
(and to some affected addons).  This feature is essentially a way to
display a nice friendly message when some business event happens.  For
example, a encouraging message is displayed when the user clear her/his
inbox, or when a salesman closes a deal.

The mechanism currently only displays a 'rainbowman', but could be
extended later to add other kind of animation.

There are a few different ways to display a 'rainbowman':
- any JS code can simply trigger_up an event ('show_effect') with some
  options: for example
    this.trigger_up('show_effect', {
        type: 'rainbow_man',
        fadeout: 'no',
        message: $done,
        click_close: false,
    });
- an action returned by the server can have an 'effect' key, with some
  options
- the do_execute_action method accepts a 'effect' option.  This is
  useful when one wants to specify a rainbow on an action button in a
  form view

Joint work with: dbh <dbh@odoo.com>, ged <ged@odoo.com>
2017-07-12 13:43:08 +02:00

163 lines
3.7 KiB
Plaintext

/************** DEFINITION of ANIMATIONS **************/
// 'marked' effects
@keyframes markAnim {
0% {
opacity: 0;
transform: scaleX(0.50) scaleY(0.50);
}
30% {
opacity: 1;
transform: scaleX(1.00) scaleY(1.00);
}
100% {
opacity: 0;
transform: scaleX(1.00) scaleY(1.00);
}
}
@-moz-keyframes markAnim {
0% {
opacity: 0;
-moz-transform: scaleX(0.50) scaleY(0.50);
}
30% {
opacity: 1;
-moz-transform: scaleX(1.00) scaleY(1.00);
}
100% {
opacity: 0;
-moz-transform: scaleX(1.00) scaleY(1.00);
}
}
@-webkit-keyframes markAnim {
0% {
opacity: 0;
-webkit-transform: scaleX(0.50) scaleY(0.50);
}
30% {
opacity: 1;
-webkit-transform: scaleX(1.00) scaleY(1.00);
}
100% {
opacity: 0;
-webkit-transform: scaleX(1.00) scaleY(1.00);
}
}
@-o-keyframes markAnim {
0% {
opacity: 0;
-o-transform: scaleX(0.50) scaleY(0.50);
}
30% {
opacity: 1;
-o-transform: scaleX(1.00) scaleY(1.00);
}
100% {
opacity: 0;
-o-transform: scaleX(1.00) scaleY(1.00);
}
}
@-ms-keyframes markAnim {
0% {
opacity: 0;
-ms-transform: scaleX(0.50) scaleY(0.50);
}
30% {
opacity: 1;
-ms-transform: scaleX(1.00) scaleY(1.00);
}
100% {
opacity: 0;
-ms-transform: scaleX(1.00) scaleY(1.00);
}
}
// 'bounce' effect
@-webkit-keyframes bounceIn {
0%, 20%, 40%, 60%, 80%, 100% {
-webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
100% {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes bounceIn {
0%, 20%, 40%, 60%, 80%, 100% {
-webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
100% {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
/************** MIXINS for ANIMATIONS **************/
.o-display-marked(@content, @top, @left, @color) {
.o-position-absolute(@top: @top, @left: @left);
font-size: 300px;
font-family: "FontAwesome";
content: @content;
color: @color;
.o-transform-origin();
.o-animation(markAnim, 1s, ease-in-out, 0s, 1, normal, forwards);
@media (max-width: @screen-sm-max) {
left: 40%;
font-size: 30vw;
}
}