pub struct Keyframes { /* private fields */ }Expand description
The steps of an animation, written as @keyframes <name>.
Style::keyframes sets an element’s animation-name to it and carries
the rule along, so the page or the patch that brings the element also
brings the rule. Two Keyframes with the same name are one rule to the
browser, and the later one in the stylesheet wins; nothing checks that
each name is used once.
use hypersig_style::value::{AnimationIterationCount, Transform, deg, ms, raw};
use hypersig_style::{Keyframes, Sheet, Style};
let spin = Keyframes::new("spin")
.at(0, Style::new().transform(raw("rotate(0deg)")))
.at(100, Style::new().transform(raw("rotate(360deg)")));
let spinner = Style::new()
.keyframes(&spin)
.animation_duration(ms(800))
.animation_iteration_count(AnimationIterationCount::Infinite);
let mut sheet = Sheet::new();
sheet.add(&spinner);
assert!(sheet.to_css().contains("@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"));Implementations§
Source§impl Keyframes
impl Keyframes
Sourcepub fn new(name: &'static str) -> Self
pub fn new(name: &'static str) -> Self
Keyframes named name, with no steps yet.
§Panics
Panics if name is empty, starts with a digit, or holds a character
other than an ASCII letter, digit, -, or _, which an
animation-name would need quoted.
Trait Implementations§
impl StructuralPartialEq for Keyframes
Auto Trait Implementations§
impl Freeze for Keyframes
impl RefUnwindSafe for Keyframes
impl Send for Keyframes
impl Sync for Keyframes
impl Unpin for Keyframes
impl UnsafeUnpin for Keyframes
impl UnwindSafe for Keyframes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more