html5 두번째 수업
html5 두번째 수업HTML var _canvas ; var _ctx ; var _time ; var _cnt = 0; var _cx =100 , cy = 100; var _cur = 0; var _arr = new Array(); var ECOUNT = 5; var DEBUG = true; var mySprite = { x: 50, y: 50, width: 64, height: 64, speed: 50, state:0, color: '#f00' }; var item = { x: 0, y: 0, width: 10, height: 10, point: 1, color: '#fff' }; function Citem() { this.x = 0; this.y = 0; this.width = 10; this.height = 10; this.speed = 1; //this.state = 0; this.color = '#fff'; this.point = 1; this.init = function() { this.point = Math.round(Math.random() * 1000 ) % 5; this.speed = Math.random() * 3; this.x = Math.random() * _canvas.width; }; this.k = 0; this.moveY = function() { this.y += 0.5 * this.speed; this.x += Math.sin(this.k++) ;