为了账号安全,请及时绑定邮箱和手机立即绑定

com.createdPattern is not a function at Image.imgs.onload

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Html5 Canvas 实现图片合成</title>

<script src="../js/jq.js"></script>

<script src="../js/base64js.min.js"></script>

<script src="../js/canvas2image.js"></script>

<script src="../js/html2canvas.js"></script>

<style>

img{border:solid 1px #ddd;}

.c-box{

display: flex;

padding: 15px;

justify-content: space-between;

}

.c-img{

display: block;

width: 45%;

height:260px;

}

.btn{

width: 40%;

height: 40px;

line-height: 40px;

text-align: center;

color: #fff;

background-color: brown;

font-size: 14px;

margin: 20px auto;

}

#imgbox{

width: 300px;

height: 500px;

}

</style>

</head>


<body>

<canvas id="canvas"></canvas>

<!-- <div align="center" class="img_photo">

   <img src="../image/canvas.jpg" alt="" class="c-img">

   <img src="../image/cq.jpg" alt="" class="c-img">

</div>

<input type="button" value="一键合成" onClick="draw()" style="display:block;width: 60px; margin: 0 auto;">

<div id="imgBox" align="center"></div> -->

<script>

var canvas=document.querySelector("#canvas")

var com=canvas.getContext('2d')

canvas.width=400;

canvas.height=400;

//   com.rect(0,0,canvas.width,canvas.height);

//   com.fillStyle='#aaa';//画布填充颜色

//   com.fill();



var imgs=new Image()

imgs.src='../image/canvas.jpg'

imgs.onload=function(){

var patter=com.createdPattern(imgs,'no-repeat')

com.fillStyle=patter

com.fillRect(0,0,400,400)

}

</script>

</body>

</html>


正在回答

1 回答

com.createdPattern is not a function多明显,createPattern不是createdPattern


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

com.createdPattern is not a function at Image.imgs.onload

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信