Hyphenated Key¶
Description: An animation
<identifier>
can be defined through a hyphenated Object key that matches animation-<identifier>
or anim-<identifier>
.
Edit
ctr('.test', {
width: 200px
animation-test: {
timeline: {
'50%': {
background: teal
}
}
}
})
.test:
width: 200px
animation-test:
timeline:
50%:
background: teal
.test {
width: 200px;
animation-delay: 0s;
animation-name: test;
animation-duration: 0.5s;
animation-fill-mode: none;
animation-direction: normal;
animation-iteration-count: 1;
animation-play-state: running;
animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes test {
50% {
background: #008080;
}
}
ctr('.test', {
width: 200px
animation-test: {
timeline: {
'50%': {
background: teal
}
}
}
})
.test {
width: 200px;
animation-delay: 0s;
animation-name: test;
animation-duration: 0.5s;
animation-fill-mode: none;
animation-direction: normal;
animation-iteration-count: 1;
animation-play-state: running;
animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes test {
50% {
background: #008080;
}
}
.test:
width: 200px
animation-test:
timeline:
50%:
background: teal
Notes
- Regex match:
/^anim-|^animation-/i
- For reference, the
anim-
oranimation-
part of the Object key is removed and what is remaining will be used as the<identifier>
- A
name
value supersedes the hyphenated value
Hash Key¶
Description: A random hash value can be generated alongside the <identifier>
or as the <identifier>
if the value matches __hash__
.
Edit
ctr('.test', {
width: 200px
animation: {
option: {
name: test__hash__
}
timeline: {
'50%': {
background: teal
}
}
}
})
.test:
width: 200px
animation:
option:
name: test__hash__
timeline:
50%:
background: teal
.test {
width: 200px;
animation-delay: 0s;
animation-duration: 0.5s;
animation-fill-mode: none;
animation-direction: normal;
animation-iteration-count: 1;
animation-play-state: running;
animation-name: test_fkqnt22ew;
animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes test_fkqnt22ew {
50% {
background: #008080;
}
}
ctr('.test', {
width: 200px
animation: {
option: {
name: test__hash__
}
timeline: {
'50%': {
background: teal
}
}
}
})
.test {
width: 200px;
animation-delay: 0s;
animation-duration: 0.5s;
animation-fill-mode: none;
animation-direction: normal;
animation-iteration-count: 1;
animation-play-state: running;
animation-name: test_fkqnt22ew;
animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes test_fkqnt22ew {
50% {
background: #008080;
}
}
.test:
width: 200px
animation:
option:
name: test__hash__
timeline:
50%:
background: teal
Notes
- Regex match:
__hash__/gi
- This is a safety precaution to avoid naming conflicts