
org.sikuli.basics.AnimatorTimeBased Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sikulixapi Show documentation
Show all versions of sikulixapi Show documentation
... for visual testing and automation
/*
* Copyright (c) 2010-2016, Sikuli.org, sikulix.com
* Released under the MIT License.
*
*/
package org.sikuli.basics;
public class AnimatorTimeBased implements Animator {
private long _begin_time;
private boolean _running;
private AnimatorTimeValueFunction _func;
public AnimatorTimeBased(AnimatorTimeValueFunction func) {
_begin_time = -1;
_running = true;
_func = func;
}
@Override
public float step() {
if (_begin_time == -1) {
_begin_time = System.currentTimeMillis();
return _func.getValue(0);
}
long now = System.currentTimeMillis();
long delta = now - _begin_time;
float ret = _func.getValue(delta);
_running = !_func.isEnd(delta);
return ret;
}
@Override
public boolean running() {
return _running;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy