shape.js 381 B

123456789101112131415161718192021
  1. import Base from './base';
  2. class Shape extends Base {
  3. constructor(cfg) {
  4. super(cfg);
  5. this.names = [ 'shape' ];
  6. this.type = 'shape';
  7. this.gradient = null;
  8. }
  9. /**
  10. * @override
  11. */
  12. getLinearValue(percent) {
  13. const values = this.values;
  14. const index = Math.round((values.length - 1) * percent);
  15. return values[index];
  16. }
  17. }
  18. export default Shape;