KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

masking/ overflow

Open Wazabii opened this issue 14 years ago • 6 comments

Hi,

I wonder if we can use masking to show objects in certain area like in flash or overflow css. Let's say when the object is within a recangle area, it'll be visible to the screen, but when it goes outside the rectangle, it'll become hidden. If only a part /half goes out of rectangle, then the only visible part is the one inside the rectangle.

I think we have linear filling like in this tutorial

http://www.html5canvastutorials.com/kineticjs/html5-canvas-set-fill-with-kineticjs/

But i'm wondering whether we put objects and animate it inside the fill.

Thanks

Wazabii avatar Nov 02 '12 13:11 Wazabii

I've had several requests to provide some sort of clipping functionality that would do exactly what you're asking for - I'll add it to my todo list :)

Thanks!

ericdrowell avatar Nov 07 '12 23:11 ericdrowell

I actually have group clipping working, at least as much as I need it to. Since the forums have been removed, I can't post code there or provide a plugin, but I do have the code to do this. And I'm not very familiar with github so I'm not sure how to submit code for review and inclusion.

The code I have isn't true group clipping since groups don't have a width or height, but my code includes the creating of a clipping rectangle to "define" the group's width and height, and includes the ability to clip a group within the clip group. The only issue with this is that the shapes must be moved, instead of moving the group. I have code to do that as well though.

Let me know if you want to review the code, and perhaps I'll look around here and figure out how to commit code.

lazerblade01 avatar Nov 13 '12 14:11 lazerblade01

Wow that would be great. I'm not familiar with github as well so it would be nice if you can deliver it somwhow.. Thanks

Wazabii avatar Feb 15 '13 09:02 Wazabii

It'll be in the next release:

https://github.com/ericdrowell/KineticJS/wiki/Release-Schedule

"container clipping function"

ericdrowell avatar Feb 15 '13 16:02 ericdrowell

Follow up - Clipping regions are now fully supported as of v4.4.0

https://github.com/ericdrowell/KineticJS/wiki/Change-Log#440-mar-26-2013

ericdrowell avatar May 09 '13 04:05 ericdrowell

This plugin seriously need better clipping techniques -- specially for custom shapes.

ImranBug avatar May 29 '14 06:05 ImranBug