While I was writing many quasi-identical CSS3 animations, I wondered if there's a way to shorten the code.
Each time, only the final keyframe is different.
@-webkit-keyframes one {
from {
[identical properties]
}
[...etc...]
80% {
[identical properties]
}
to {
margin-left: 20px;
}
}
@-webkit-keyframes two {
from {
[identical properties]
}
[...etc...]
80% {
[identical properties]
}
to {
margin-left: 50px;
}
}
That code is pretty long so I thought it could be easily shortened but looks like you have to define the whole animation over and over. I tried something like this, but that doesn't work in Chrome and Safari.
@-webkit-keyframes one, two {
from {
[identical properties]
}
[...etc...]
80% {
[identical properties]
}
to {
margin-left: 20px;
}
}
@-webkit-keyframes two {
to {
margin-left: 50px;
}
}
Is there no way to define 2 identical animations? :o