Function repeat_timeout

Source
pub fn repeat_timeout(tm: f64, handle: TimeoutHandle)
Expand description

Repeats the timeout callback, associated with the hadle, from the expiration of the previous timeout. You may only call this method inside a timeout callback. The timeout duration tm is indicated in seconds Example:

use fltk::{prelude::*, *};
fn main() {
    let callback = |handle| {
        println!("TICK");
        app::repeat_timeout(1.0, handle);
    };

    let app = app::App::default();
    let mut wind = window::Window::new(100, 100, 400, 300, "");
    wind.show();
    app::add_timeout(1.0, callback);
    app.run().unwrap();
}
Examples found in repository?
examples/animations.rs (line 52)
45fn move_image(mut frm: Frame, handle: app::TimeoutHandle) {
46    let (x, y) = (frm.x(), frm.y());
47    frm.resize(x + 5, y, frm.w(), frm.h());
48    app::redraw();
49    if frm.x() > 260 {
50        app::remove_timeout(handle)
51    } else {
52        app::repeat_timeout(0.016, handle);
53    }
54}