melanke / CascadeCanvas

A framework for canvas that follows the Javascript patterns you already know
6 stars 0 forks source link

A method for element and elementlist to create a mask, the elements in this selection will be show only inside this mask #17

Open melanke opened 11 years ago

melanke commented 11 years ago

CC("InsideInnerFrame").mask([ [30,30], [430,30], [430,130], [30,130] ]);

Might be a difficult task

melanke commented 11 years ago

maybe this can help http://www.html5canvastutorials.com/advanced/html5-canvas-global-composite-operations-tutorial/

each layer, before drawing itself, loads the mask of its element, make the path of the mask, and then:

CC.context.globalCompositeOperation = "source-in";
melanke commented 10 years ago
//a mask may have all params that define a shape
var mask = {
    shape: "rect",
    w: 300,
    h: 200,
    fixed: true //and an extra param to make it fixed to screen
};

CC.merge(CC("#Element").e(0).layers["first"], {
    mask: mask
});
melanke commented 9 years ago

CC.context.globalCompositeOperation is already being use in blendMode, so... I don't know if it will be possible to use it twice