1.加载显示图片 <canvas id="canvasOne" class="myCanvas" width="500" height="500"></canvas> <script> var canvas = document.getElementById('canvasOne'); var ctx = canvas.getContext('2d'); //加载图片 var img = n
/** * 图片绕边旋转的小动画 */ function initDemo10() { var canvas = document.getElementById("demo10"); if (!canvas) { return; } var context = canvas.getContext("2d"); var img = new Image(); img.src ="images/timg3.jpg"; img.onload = func
/** * 图片平铺 */ function initDemo7(){ var canvas = document.getElementById("demo7"); if (!canvas) return; var context = canvas.getContext("2d"); var type = [ "no-repeat", // 不平铺 "repeat-x", // 横向平铺 "repeat-y"