5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/animate_it/embed_styles.rb', line 5
def chapter_source
@chapter_source ||= <<~CSS.freeze
.animate-it-chapters {
--animate-it-progress-color: #28d2bc;
--animate-it-progress-width: 2.5px;
--animate-it-active-glow: 0 0 10px 2px rgb(40 210 188 / 42%);
--animate-it-chapter-color: #414b57;
--animate-it-chapter-background: #fff;
--animate-it-chapter-shadow: 0 4px 12px rgb(39 47 57 / 8%);
--animate-it-chapter-font: 700 14px/1 system-ui, sans-serif;
--animate-it-chapter-gap: 14px;
--animate-it-chapter-height: 44px;
--animate-it-carousel-distance: 108%;
--animate-it-carousel-scale: .84;
--animate-it-carousel-opacity: .68;
--animate-it-carousel-duration: 180ms;
display: grid;
grid-template-columns: repeat(var(--animate-it-chapter-count, 4), minmax(0, 1fr));
gap: var(--animate-it-chapter-gap);
}
.animate-it-chapter--pills {
--animate-it-chapter-progress: 0;
--animate-it-chapter-active: 0;
--animate-it-chapter-complete: 0;
position: relative;
min-width: 0;
min-height: 44px;
height: var(--animate-it-chapter-height);
padding: 2px;
border: 0;
border-radius: 999px;
appearance: none;
color: var(--animate-it-chapter-color);
background: var(--animate-it-chapter-background);
box-shadow: var(--animate-it-chapter-shadow);
cursor: pointer;
}
.animate-it-chapter--pills[data-chapter-state="current"] { box-shadow: var(--animate-it-active-glow); }
.animate-it-chapter--pills:focus-visible { outline: 3px solid var(--animate-it-progress-color); outline-offset: 3px; }
.animate-it-chapter__progress { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.animate-it-chapter__progress rect {
fill: none;
stroke: var(--animate-it-progress-color);
stroke-width: var(--animate-it-progress-width);
stroke-dasharray: var(--animate-it-chapter-progress) 1;
stroke-opacity: clamp(0, calc(var(--animate-it-chapter-progress) * 1000), 1);
stroke-linecap: round;
vector-effect: non-scaling-stroke;
}
.animate-it-chapter__label {
position: relative;
display: flex;
height: 100%;
align-items: center;
justify-content: center;
opacity: calc(.58 + (var(--animate-it-chapter-active) * .42));
font: var(--animate-it-chapter-font);
}
@media (max-width: 767px) {
.animate-it-chapters--mobile-carousel { position: relative; display: block; height: var(--animate-it-chapter-height); overflow: clip; }
.animate-it-chapters--mobile-carousel .animate-it-chapter--pills {
position: absolute;
left: 50%;
width: min(31.25%, 122px);
transition: transform var(--animate-it-carousel-duration) ease, opacity var(--animate-it-carousel-duration) ease;
}
.animate-it-chapters--mobile-carousel .animate-it-chapter--pills[data-chapter-position="previous"] { transform: translateX(calc(-50% - var(--animate-it-carousel-distance))) scale(var(--animate-it-carousel-scale)); opacity: var(--animate-it-carousel-opacity); }
.animate-it-chapters--mobile-carousel .animate-it-chapter--pills[data-chapter-position="current"] { transform: translateX(-50%); opacity: 1; }
.animate-it-chapters--mobile-carousel .animate-it-chapter--pills[data-chapter-position="next"] { transform: translateX(calc(-50% + var(--animate-it-carousel-distance))) scale(var(--animate-it-carousel-scale)); opacity: var(--animate-it-carousel-opacity); }
.animate-it-chapters--mobile-carousel .animate-it-chapter--pills[data-chapter-position="hidden"] { visibility: hidden; pointer-events: none; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
.animate-it-chapter--pills { transition: none !important; }
}
CSS
end
|