Forum Moderators: not2easy

Message Too Old, No Replies

Animation Shorthand

Specifing keyframe instead of keyframe name

         

ocon

8:14 am on Jun 18, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



Is there a way to specify the keyframe instead of the keyframe name in my animation attribute?

Instead of:
@keyframes v{0% {top:100%} 100% {top:0}}
@keyframes h{0% {margin-left:-9px} 100% {margin-left:9px}}
.ex{animation:v 15s linear, h 4s ease-in-out alternate}

Something like:
.ex{animation:{0% {top:100%} 100% {top:0}} 15s linear, {0% {margin-left:-9px} 100% {margin-left:9px}} 4s ease-in-out alternate}

not2easy

1:35 pm on Jun 18, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The keyframes selector is required, without that the properties are ignored.
Keyframes are used to specify the values for the animating properties at various points during the animation. The keyframes specify the behavior of one cycle of the animation; the animation may iterate one or more times.

Keyframes are specified using a specialized CSS at-rule. A @keyframes rule consists of the keyword "@keyframes", followed by an identifier giving a name for the animation (which will be referenced using ‘animation-name’), followed by a set of style rules (delimited by curly braces).

This according to W3C: [w3.org...] although animations are still a work in progress and may evolve new syntax at some date. It is detailed about 1.3 down the page at "4. Keyframes".