Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/actor/reactor/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ pub struct Animation<'a> {

impl<'a> Animation<'a> {
pub fn new(fps: f64, duration: f64, _: AnimationEasing) -> Self {
// When fps is 0 (or negative), use the display's native refresh rate.
// Fall back to 60 Hz if the rate cannot be determined.
let fps = if fps > 0.0 {
fps
} else {
crate::sys::display_link::get_display_refresh_rate().unwrap_or(60.0)
};
let interval = Duration::from_secs_f64(1.0 / fps);
// let now = unsafe { CFAbsoluteTimeGetCurrent() };
let now = Instant::now();
Expand Down