The @keyframes rule is used to specify the animation code. It is created by gradually changing from one set of CSS styles to another.