All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sikuli.basics.AnimatorLinearInterpolation Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
/*
 * Copyright (c) 2010-2019, sikuli.org, sikulix.com - MIT license
 */

package org.sikuli.basics;

public class AnimatorLinearInterpolation extends AnimatorTimeValueFunction {

  float _stepUnit;

  public AnimatorLinearInterpolation(float beginVal, float endVal, long totalTime) {
    super(beginVal, endVal, totalTime);
    _stepUnit = (endVal - beginVal) / (float) totalTime;
  }

  @Override
  public float getValue(long t) {
    if (t > _totalTime) {
      return _endVal;
    }
    return _beginVal + _stepUnit * t;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy