对象化 Canvas oCanvas

码农软件 · 软件分类 · HTML5开发相关 · 2019-03-08 12:28:37

软件介绍

oCanvas 可以帮助你很容易的在 HTML5 的 Canvas 标签上创建对象,并且创建这些对象的动画。支持包括 IE9 以及更新版本和其他包括 FF、Chrome、Safari 和 Opera 浏览器。

该库包含 9 部分:

  1. oCanvas Object: which represents the HTML5 Canvas element itself, where everything will be built. 

  2. Core: is the main instance which defines all other elements. 

  3. Display Objects: representing the main predefined geometrical elements (lines, triangles, rectangles, etc.). 

  4. Background: stores settings of object surface. 

  5. Canvas.Timeline: facilitates the creation of loops for moving objects. 

  6. Events: capturing the events that can occur with the keyboard, mouse, and touch. 

  7. Scenes: We can group objects into independent "frames". 

  8. Animation: Lets you create short animations for each object. 

  9. Draw: Module that allows you to clean or repaint the scenes.

示例代码:

function createAnim() {
 
  //Block 1
  var tela = oCanvas.create({
    canvas: "#canvas",
    background: "#ccc"
  });
 
  //Block 2
  var quadrado = tela.display.rectangle({
    x: 25,
    y: 25,
    width: 20,
    height: 20, 
    fill: "#0aa",
    velocX: 4,
    velocY: 4
  });
  tela.addChild(quadrado);

  //Block 3
   
  tela.bind("click tap", function() {
    quadrado.x = tela.mouse.x;
    quadrado.y = tela.mouse.y;
  });

  //Block 4
  tela.setLoop(function() {
    quadrado.x += quadrado.velocX;
    quadrado.y += quadrado.velocY;
    quadrado.rotation++;    
    if ((quadrado.x <= 0) || (quadrado.x >= (tela.width)))  
      quadrado.velocX = -quadrado.velocX;
    if ((quadrado.y < 20) || (quadrado.y > (tela.height - 20))) 
      quadrado.velocY = -quadrado.velocY;
  }).start();
 
}

本文地址:https://www.codercto.com/soft/d/891.html

ASP.NET网页制作教程

ASP.NET网页制作教程

王国荣 / 华中科技 / 2002-1 / 78.00元

《ASP.NET网页制作教程:从基本语法学起(附光盘)》分为:基础篇、对象应用篇、案例研究篇。奠定ASP网页制作的基础,使用Server控件制作互动网页,使用ADO.NET访问数据库;计费网费、会员管理、访客计数器Server版、访客留言板、新闻讨论群组、电子贺卡、E-mail自动传送、FIP文件上传、在线投票、在线问卷调查、在线购物、在线考试、广告回旋板、聊天室。一起来看看 《ASP.NET网页制作教程》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换