当前位置: 动力学知识库 > 问答 > 编程问答 >

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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: