[gtk+] Adwaita: use a transition to animate checks and radios
- From: Lapo Calamandrei <lapo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Adwaita: use a transition to animate checks and radios
- Date: Wed, 27 Jul 2016 21:00:52 +0000 (UTC)
commit 15b2dbf9a8e6de17fb74eef989ed5923ef6c6180
Author: Lapo Calamandrei <calamandrei gmail com>
Date: Wed Jul 27 22:54:20 2016 +0200
Adwaita: use a transition to animate checks and radios
see https://bugzilla.gnome.org/show_bug.cgi?id=762260
gtk/theme/Adwaita/_common.scss | 41 ++++++++++--------------
gtk/theme/Adwaita/gtk-contained-dark.css | 51 ++++++++++++------------------
gtk/theme/Adwaita/gtk-contained.css | 51 ++++++++++++------------------
3 files changed, 57 insertions(+), 86 deletions(-)
---
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 58a320c..c0d4595 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -2626,7 +2626,6 @@ radio {
-gtk-icon-shadow: none;
color: inherit;
border-color: currentColor;
- animation: none;
}
}
}
@@ -2653,34 +2652,28 @@ radio {
-gtk-recolor(url("assets/dash-symbolic.symbolic.png"))); }
}
-// let's animate things
-@keyframes check_check {
- from { -gtk-icon-transform: translate(6px, -3px) rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
- to { -gtk-icon-transform: unset; }
-}
-
-@keyframes check_radio {
- from { -gtk-icon-transform: scale(0); }
- to { -gtk-icon-transform: unset; }
-}
-
-@keyframes check_indeterminate {
- from { -gtk-icon-transform: scale(0, 1); }
- to { -gtk-icon-transform: unset; }
-}
+// ANIMATION:
+// this is made with those pretty convoluted transitions, since checks and radios have to animate only on
state changes,
+// the transformation is set on the active state and it get reset on the checked state.
+radio:not(:indeterminate):not(:checked):active:not(:backdrop) { -gtk-icon-transform: scale(0); }
-check:not(:indeterminate):checked { animation: check_check 400ms; }
+check:not(:indeterminate):not(:checked):active:not(:backdrop) { -gtk-icon-transform: translate(6px, -3px)
rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
-radio:not(:indeterminate):checked { animation: check_radio 400ms; }
+radio,
+check {
+ &:active { -gtk-icon-transform: scale(0, 1); } // should tackle the indeterminate state, untested
-check:indeterminate:checked, radio:indeterminate:checked { animation: check_indeterminate 400ms; }
+ &:checked:not(:backdrop), &:indeterminate:not(:backdrop) {
+ -gtk-icon-transform: unset;
+ transition: 400ms;
+ }
+}
-// no animations in menus
menu menuitem {
- check:not(:indeterminate):checked,
- radio:not(:indeterminate):checked,
- check:indeterminate:checked:active,
- radio:indeterminate:checked { animation: none; }
+ radio,
+ check {
+ &:checked:not(:backdrop), &:indeterminate:not(:backdrop) { transition: none; }
+ }
}
treeview.view check,
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 76801c7..8423911 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2970,8 +2970,7 @@ radio {
box-shadow: none;
-gtk-icon-shadow: none;
color: inherit;
- border-color: currentColor;
- animation: none; }
+ border-color: currentColor; }
check {
border-radius: 3px; }
@@ -2990,35 +2989,25 @@ radio {
radio:indeterminate {
-gtk-icon-source: image(-gtk-recolor(url("assets/dash-symbolic.svg")),
-gtk-recolor(url("assets/dash-symbolic.symbolic.png"))); }
-@keyframes check_check {
- from {
- -gtk-icon-transform: translate(6px, -3px) rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
- to {
- -gtk-icon-transform: unset; } }
-@keyframes check_radio {
- from {
- -gtk-icon-transform: scale(0); }
- to {
- -gtk-icon-transform: unset; } }
-@keyframes check_indeterminate {
- from {
- -gtk-icon-transform: scale(0, 1); }
- to {
- -gtk-icon-transform: unset; } }
-check:not(:indeterminate):checked {
- animation: check_check 400ms; }
+radio:not(:indeterminate):not(:checked):active:not(:backdrop) {
+ -gtk-icon-transform: scale(0); }
-radio:not(:indeterminate):checked {
- animation: check_radio 400ms; }
+check:not(:indeterminate):not(:checked):active:not(:backdrop) {
+ -gtk-icon-transform: translate(6px, -3px) rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
-check:indeterminate:checked, radio:indeterminate:checked {
- animation: check_indeterminate 400ms; }
+radio:active,
+check:active {
+ -gtk-icon-transform: scale(0, 1); }
+radio:checked:not(:backdrop), radio:indeterminate:not(:backdrop),
+check:checked:not(:backdrop),
+check:indeterminate:not(:backdrop) {
+ -gtk-icon-transform: unset;
+ transition: 400ms; }
-menu menuitem check:not(:indeterminate):checked,
-menu menuitem radio:not(:indeterminate):checked,
-menu menuitem check:indeterminate:checked:active,
-menu menuitem radio:indeterminate:checked {
- animation: none; }
+menu menuitem radio:checked:not(:backdrop), menu menuitem radio:indeterminate:not(:backdrop),
+menu menuitem check:checked:not(:backdrop),
+menu menuitem check:indeterminate:not(:backdrop) {
+ transition: none; }
treeview.view check:selected:focus, treeview.view check:selected,
treeview.view radio:selected:focus,
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 1e71d62..ab18b54 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -3000,8 +3000,7 @@ radio {
box-shadow: none;
-gtk-icon-shadow: none;
color: inherit;
- border-color: currentColor;
- animation: none; }
+ border-color: currentColor; }
check {
border-radius: 3px; }
@@ -3020,35 +3019,25 @@ radio {
radio:indeterminate {
-gtk-icon-source: image(-gtk-recolor(url("assets/dash-symbolic.svg")),
-gtk-recolor(url("assets/dash-symbolic.symbolic.png"))); }
-@keyframes check_check {
- from {
- -gtk-icon-transform: translate(6px, -3px) rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
- to {
- -gtk-icon-transform: unset; } }
-@keyframes check_radio {
- from {
- -gtk-icon-transform: scale(0); }
- to {
- -gtk-icon-transform: unset; } }
-@keyframes check_indeterminate {
- from {
- -gtk-icon-transform: scale(0, 1); }
- to {
- -gtk-icon-transform: unset; } }
-check:not(:indeterminate):checked {
- animation: check_check 400ms; }
+radio:not(:indeterminate):not(:checked):active:not(:backdrop) {
+ -gtk-icon-transform: scale(0); }
-radio:not(:indeterminate):checked {
- animation: check_radio 400ms; }
+check:not(:indeterminate):not(:checked):active:not(:backdrop) {
+ -gtk-icon-transform: translate(6px, -3px) rotate(-45deg) scaleY(0.2) rotate(45deg) scaleX(0); }
-check:indeterminate:checked, radio:indeterminate:checked {
- animation: check_indeterminate 400ms; }
+radio:active,
+check:active {
+ -gtk-icon-transform: scale(0, 1); }
+radio:checked:not(:backdrop), radio:indeterminate:not(:backdrop),
+check:checked:not(:backdrop),
+check:indeterminate:not(:backdrop) {
+ -gtk-icon-transform: unset;
+ transition: 400ms; }
-menu menuitem check:not(:indeterminate):checked,
-menu menuitem radio:not(:indeterminate):checked,
-menu menuitem check:indeterminate:checked:active,
-menu menuitem radio:indeterminate:checked {
- animation: none; }
+menu menuitem radio:checked:not(:backdrop), menu menuitem radio:indeterminate:not(:backdrop),
+menu menuitem check:checked:not(:backdrop),
+menu menuitem check:indeterminate:not(:backdrop) {
+ transition: none; }
treeview.view check:selected:focus, treeview.view check:selected,
treeview.view radio:selected:focus,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]