示例:
html
<div class="box" id="box"></div>
.box{
width: 100%;height: 500px;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);background-image: url(../images/bgg.png);background-size: 7.5rem 8.73rem;}
js
//参数说明 第一个参数:将画布塞在某盒子中 第二个参数:遮罩的图片地址
initCanvas('#box'