Skip to content

Commit fdfecf3

Browse files
authored
Add step-start and step-and to timings constant (tailwindlabs#4795)
Co-authored-by: Tim Kleyersburg <tk@wacg.de>
1 parent b3d5b4e commit fdfecf3

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/util/parseAnimationValue.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ const DIRECTIONS = new Set(['normal', 'reverse', 'alternate', 'alternate-reverse
22
const PLAY_STATES = new Set(['running', 'paused'])
33
const FILL_MODES = new Set(['none', 'forwards', 'backwards', 'both'])
44
const ITERATION_COUNTS = new Set(['infinite'])
5-
const TIMINGS = new Set(['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out'])
5+
const TIMINGS = new Set([
6+
'linear',
7+
'ease',
8+
'ease-in',
9+
'ease-out',
10+
'ease-in-out',
11+
'step-start',
12+
'step-end',
13+
])
614
const TIMING_FNS = ['cubic-bezier', 'steps']
715

816
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.

tests/plugins/animation.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ test('defining animation and keyframes', () => {
1313
none: 'none',
1414
spin: 'spin 1s linear infinite',
1515
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite',
16+
blink: 'blink 1s step-end infinite',
1617
},
1718
keyframes: {
1819
spin: { to: { transform: 'rotate(360deg)' } },
1920
ping: { '75%, 100%': { transform: 'scale(2)', opacity: '0' } },
21+
blink: { '50%': { transform: 'scale(2)' } },
2022
},
2123
},
2224
variants: {
@@ -43,11 +45,20 @@ test('defining animation and keyframes', () => {
4345
}
4446
}
4547
48+
@layer utilities {
49+
@variants {
50+
@keyframes blink {
51+
50% { transform: scale(2); }
52+
}
53+
}
54+
}
55+
4656
@layer utilities {
4757
@variants {
4858
.animate-none { animation: none; }
4959
.animate-spin { animation: spin 1s linear infinite; }
5060
.animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
61+
.animate-blink { animation: blink 1s step-end infinite; }
5162
}
5263
}
5364
`)

0 commit comments

Comments
 (0)