1. e-works数字化企业网
  2. 书屋
  3. 书籍列表
  4. HTML5 Canvas核心技术—图形、动画与游戏开发
  5. 离屏canvas

第一章 基础知识

第一十零节 离屏canvas


    程序清单1-14 以图像方式实现的时钟程序(JavaScript代码,节选)

// Some declarations and functions omitted for brevity.

// See Section 1.9 for a complete listing of

// the clock.

var canvas = document.getElementById('canvas'),

    context = canvas.getContext('2d'),

    ...

// Functions..........................................................

function updateClockImage() {

   snapshotImageElement.src = canvas.toDataURL();

}

function drawClock() {

   context.clearRect(0, 0, canvas.width,canvas.height);

   context.save();

   context.fillStyle = 'rgba(255,255,255,0.8)';

   context.fillRect(0, 0, canvas.width,canvas.height);

   drawCircle();

   drawCenter();

   drawHands();

   context.restore();

   drawNumerals();

   updateClockImage();

}

...

系列微信

数字化企业网
PLM之神
e-works制信科技
MES百科
工业自动化洞察
智能制造IM
AI智造圈
智能工厂前线
工业机器人洞察
智造人才圈
工业软件应用
智能制造网博会
ERP之家
供应链指南针
© 2002-2025  武汉制信科技有限公司  版权所有  ICP经营许可证:鄂B2-20030029-1(于2003年首获许可证:鄂B2-20030029)
鄂公网安备:420100003343号 法律声明及隐私权政策     投诉举报电话:027-87592219

关于我们    |    联系我们    |    隐私条款

ICP经营许可证:鄂B2-20080078
(于2003年首获许可证:鄂B2-20030029)
鄂公网安备:420100003343号
© 2002-2025  武汉制信科技有限公司  版权所有
投诉举报电话:027-87592219

扫码查看