58 lines
1.1 KiB
JavaScript
Executable File
58 lines
1.1 KiB
JavaScript
Executable File
|
|
var canvas;
|
|
var ctx;
|
|
var starPool = new Array();
|
|
var stop = false;
|
|
|
|
|
|
$(function() {
|
|
canvas=document.getElementById("bg");
|
|
ctx = canvas.getContext("2d");
|
|
|
|
canvas.width = $(document).width()-20;
|
|
canvas.height = $(document).height()-20;
|
|
//starPool[0] = new sparkle(120, 100, false, 0.4);
|
|
//initiate();
|
|
//main();
|
|
//star(ctx,100,100,40,5,0.5);
|
|
});
|
|
|
|
|
|
var requestAnimFrame = (function(){
|
|
return window.requestAnimationFrame ||
|
|
window.webkitRequestAnimationFrame ||
|
|
window.mozRequestAnimationFrame ||
|
|
window.oRequestAnimationFrame ||
|
|
window.msRequestAnimationFrame ||
|
|
function(callback){
|
|
window.setTimeout(callback, 1000 / 60);
|
|
};
|
|
})();
|
|
|
|
function initiate(){
|
|
|
|
}
|
|
|
|
function main(){
|
|
ctx.clearRect(0, 0, $(document).width()-20, $(document).height()-20);
|
|
callframe();
|
|
if(stop==true){
|
|
console.log("ended");
|
|
}else{
|
|
requestAnimFrame(main);
|
|
}
|
|
}
|
|
|
|
function callframe(){
|
|
//animation goes here...
|
|
|
|
|
|
}
|
|
|
|
|
|
function background(){
|
|
ctx.fillStyle="green";
|
|
ctx.fillRect(0,canvas.height/5*3,canvas.width,canvas.height/5*2);
|
|
}
|
|
|