在线教程

  • js syntax basics

    ... 数组的一个元素。比如披头士乐队,包含若干成员: var beatles = Array(4); 有时候我们不能提前知道元素的个数,这要求数组能够动态分配和管理。在JS里, ... 该数组就是数字类型的。 我们可以通过指定元素的索引来改变这一缺省行为,比如使用字符串: var lennon = Array(); lennon["name"] = "John"; lennon["year"] = 1940; lennon["living"] = false; 这被称之为关联数组。数字数组实际上是 ...

  • html canvas animation object

    ... 起来也许很复杂,其实该方法就是在数组的末尾添加对象。在本例中,该对象是一个形状对象。其功能与以下代码完全相同: var shapes = new Array(); shapes[0] = new Shape(50, 50); shapes[1] = new Shape(100, 100); shapes[2] = new Shape(150, 150); 使用push方法的好处是,无须知道数组中最后一个元素的序号,该方法将会自动在数组的末端 ...

  • html canvas animation bounce

    ... function(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; }; var shapes = new Array(); for (var i = 0; i < 10; i++) { var x = Math.random()*250; var y = Math.random()*250; var width = height ...

  • html canvas animation circular

    ... = x; this.y = y; this.width = width; this.height = height; this.radius = Math.random()*30; this.angle = 0; }; var shapes = new Array(); for (var i = 0; i < 10; i++) { var x = Math.random()*250; var y = Math.random()*250; var width = height ...

  • html canvas drawimage

    ... var trueY = (r * tileHeight) + tr; // Calculate the position of the current pixel in the array var pos = (trueY * (imageData3.width * 4)) + (trueX * 4); // Assign the colour to ...

  • html canvas animation physics

    ... = false; }); var Asteroid = function(x, y, radius) { this.x = x; this.y = y; this.radius = radius; }; var asteroids = new Array(); for (var i = 0; i < 10; i++) { var x = 20+(Math.random()*(canvasWidth-40)); var y = 20+(Math.random ...

  • html local storage

    12.27 HTML 本地存储(Local Storage) HTML本地存储允许在本地浏览器中存储数据 如课程引言中所述,本地应用程序(如移动APP)能够利用本地操作系统的文件系统来存储和读取数据,这使得其可以在离线环境下工作,由于节省了大量网络数据传输,从而可以获得更高的性能。 HTML5里面引入的本地存储(Local Storage)接口就是为了达到相同的目的,把部分 ...

推广服务(新)
最新文章