I'm using the web_sys crate in Rust to manually set a div's animation property:

    let animation1 = format!("animation1 {}ms ease-in-out forwards", DURATION);

    // html_element is type web_sys::HtmlElement
    html_element.style().set_property("animation", &animation1).unwrap();

I also have a event listener for both the animationend and animationcancel events, specifically listening for "animation1" to end.

In Chrome the animationcancel event is logged intermittently, with the majority of animation1 instances firing off animationend.

However, this is inconsistent with the results from checking each CSSAnimation's playState field manually:

let animations = document.get_animations();

for animation in animations {
    let animation = CssAnimation::from(animation);
    if animation.animation_name() == "animation1" {
        log!(animation.play_state());
    }
}

Where each log! statement inside this loop always prints "finished".

Furthermore, upon testing this in Firefox, the animationcancel event is never fired and the animationend is always fired.

Does anyone know what might be causing this, or whether this is a known issue?

Chrome Version 114.0.5735.198 (Official Build) (arm64).

Firefox 114.0.2 (64-bit).
0

There are 0 answers