"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _core = require("@math.gl/core");

var _transition = _interopRequireDefault(require("./transition"));

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var CPUInterpolationTransition = function (_Transition) {
  (0, _inherits2.default)(CPUInterpolationTransition, _Transition);

  var _super = _createSuper(CPUInterpolationTransition);

  function CPUInterpolationTransition() {
    var _this;

    (0, _classCallCheck2.default)(this, CPUInterpolationTransition);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this._value = void 0;
    return _this;
  }

  var _proto = CPUInterpolationTransition.prototype;

  _proto._onUpdate = function _onUpdate() {
    var time = this.time,
        _this$settings = this.settings,
        fromValue = _this$settings.fromValue,
        toValue = _this$settings.toValue,
        duration = _this$settings.duration,
        easing = _this$settings.easing;
    var t = easing(time / duration);
    this._value = (0, _core.lerp)(fromValue, toValue, t);
  };

  (0, _createClass2.default)(CPUInterpolationTransition, [{
    key: "value",
    get: function get() {
      return this._value;
    }
  }]);
  return CPUInterpolationTransition;
}(_transition.default);

exports.default = CPUInterpolationTransition;
//# sourceMappingURL=cpu-interpolation-transition.js.map