Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. var canvas = new fabric.Canvas('canvas')
  2.  
  3. var rect = new fabric.Rect({
  4. width: 100,
  5. height:100,
  6. fill: 'red',
  7. left: 100,
  8. top: 100
  9. });
  10.  
  11. canvas.add(rect)
  12.  
  13. var clipGroup = new fabric.Group([
  14. new fabric.Circle({
  15. radius: 50,
  16. left: -50,
  17. top: -50
  18. }),
  19. new fabric.Rect({
  20. width: 25,
  21. height: 25,
  22. left: 0,
  23. top: 0,
  24. globalCompositeOperation: 'destination-out'
  25. })
  26. ]);
  27.  
  28. rect.clipPath = clipGroup;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement