andr111
andr111

Reputation: 3052

Make a portion of div transparent with HTML5 and canvas

I'm working on scratch off HTML5 effect and I need both background and foreground to be DIVs with animated content inside. So I need Foreground DIV on top of Background DIV and I want to mask regions of the Foreground DIV as user scratches them off. Is it possible?

I need to create this: http://beej.us/x/scratcher/, but with DIVs instead of both background and foreground images.

Upvotes: 1

Views: 1089

Answers (1)

Simon Sarris
Simon Sarris

Reputation: 63812

You can't make a portion of a div transparent using a canvas.

you can sorta pretend, like if the background of the div is white you can paint white over parts of the div. So you sorta make the illusion of it like here. But that's really situational.

Upvotes: 2

Related Questions