Skip to content

Commit a861e12

Browse files
committed
feat(touch-ripple): tweak touch ripple appearance
1 parent 24025a5 commit a861e12

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

src/core/components/touch-ripple/touch-ripple-class.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default class TouchRipple {
4545

4646
$el.prepend(ripple.$rippleWaveEl);
4747

48-
ripple.$rippleWaveEl.animationEnd(() => {
48+
ripple.$rippleWaveEl.animationEnd((e) => {
49+
if ((e.animationName && e.animationName === 'touch-ripple-bg-in') || e.pseudoElement) return;
4950
if (!ripple.$rippleWaveEl) return;
5051
if (ripple.$rippleWaveEl.hasClass('ripple-wave-out')) return;
5152
ripple.$rippleWaveEl.addClass('ripple-wave-in');
@@ -79,7 +80,8 @@ export default class TouchRipple {
7980
ripple.destroy();
8081
}, 300);
8182

82-
$rippleWaveEl.animationEnd(() => {
83+
$rippleWaveEl.animationEnd((e) => {
84+
if ((e.animationName && e.animationName === 'touch-ripple-bg-in') || e.pseudoElement) return;
8385
clearTimeout(ripple.removeTimeout);
8486
ripple.destroy();
8587
});

src/core/components/touch-ripple/touch-ripple.less

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,31 @@
2828
margin: 0;
2929
font-size: 0;
3030
transform: translate3d(0px, 0px, 0) scale(0);
31-
background-color: var(--f7-touch-ripple-color);
31+
background-image: radial-gradient(
32+
closest-side circle at 50% 50%,
33+
var(--f7-touch-ripple-color),
34+
rgba(255, 255, 255, 0)
35+
);
36+
background-color: transparent !important;
3237
animation: touch-ripple-in 200ms forwards;
38+
&::before {
39+
content: '';
40+
border-radius: 50%;
41+
position: absolute;
42+
width: 100%;
43+
height: 100%;
44+
left: 0;
45+
top: 0;
46+
animation: touch-ripple-bg-in 200ms forwards;
47+
background-image: radial-gradient(
48+
closest-side circle at 50% 50%,
49+
rgba(255, 255, 255, 0),
50+
var(--f7-touch-ripple-color)
51+
);
52+
}
3353
&.ripple-wave-out {
3454
transform: var(--f7-ripple-transform);
35-
animation: touch-ripple-out 300ms forwards;
36-
}
37-
.button-fill &,
38-
.picker-calendar-day & {
39-
z-index: 1;
55+
animation: touch-ripple-out 250ms forwards;
4056
}
4157
}
4258
.checkbox,
@@ -53,12 +69,24 @@
5369

5470
@keyframes touch-ripple-in {
5571
from {
56-
transform: translate3d(0px, 0px, 0) scale(0);
72+
transform: translate3d(0px, 0px, 0) scale(0.5);
5773
}
5874
to {
5975
transform: var(--f7-ripple-transform);
6076
}
6177
}
78+
79+
@keyframes touch-ripple-bg-in {
80+
0% {
81+
opacity: 0;
82+
}
83+
50% {
84+
opacity: 0;
85+
}
86+
to {
87+
opacity: 1;
88+
}
89+
}
6290
@keyframes touch-ripple-out {
6391
from {
6492
opacity: 1;

0 commit comments

Comments
 (0)