growInX.js 868 B

1234567891011121314151617181920212223242526
  1. import { Path } from '@antv/g';
  2. import { ScaleInX } from './scaleInX';
  3. /**
  4. * Scale mark from nothing to desired shape in x direction.
  5. */
  6. export const GrowInX = (options) => {
  7. return (from, to, value, coordinate, defaults) => {
  8. const [shape] = from;
  9. const { height, width } = shape.getBoundingClientRect();
  10. const clipPath = new Path({
  11. style: {
  12. path: `M0,0L${width},0L${width},${height}L0,${height}Z`,
  13. },
  14. });
  15. shape.appendChild(clipPath);
  16. shape.style.clipPath = clipPath;
  17. const animation = ScaleInX(options)([clipPath], to, value, coordinate, defaults);
  18. animation.finished.then(() => {
  19. clipPath.remove();
  20. shape.style.clipPath = null;
  21. });
  22. return animation;
  23. };
  24. };
  25. GrowInX.props = {};
  26. //# sourceMappingURL=growInX.js.map