function Bullet() {
/*Переменные
--------------------------------------------*/
var HTMLElement, animationFrameId;
/*Свойства
--------------------------------------------*/
this.startTime = new Date;
this.target = new Point();
this.position = new Point();
this.speed = 100;
this.stop = stop;
this.sayHi = sayHi;
/*Инициализация
--------------------------------------------*/
HTMLElement = document.createElement('div');
HTMLElement.className = 'bullet';
document.body.appendChild(HTMLElement);
render();
/*Методы
--------------------------------------------*/
function render() {
step();
this._animationFrameId = requestAnimationFrame(render, HTMLElement);
}
function stop() {
cancelRequestAnimationFrame(animationFrameId);
}
function step() {
console.log('fly');
}
function sayHi() {
alert('hi')
}
}