shape.js 774 B

1234567891011121314151617181920212223242526272829303132333435
  1. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  2. var Base = require('./base');
  3. var Shape =
  4. /*#__PURE__*/
  5. function (_Base) {
  6. _inheritsLoose(Shape, _Base);
  7. function Shape(cfg) {
  8. var _this;
  9. _this = _Base.call(this, cfg) || this;
  10. _this.names = ['shape'];
  11. _this.type = 'shape';
  12. _this.gradient = null;
  13. return _this;
  14. }
  15. /**
  16. * @override
  17. */
  18. var _proto = Shape.prototype;
  19. _proto.getLinearValue = function getLinearValue(percent) {
  20. var values = this.values;
  21. var index = Math.round((values.length - 1) * percent);
  22. return values[index];
  23. };
  24. return Shape;
  25. }(Base);
  26. module.exports = Shape;