forked from varia/varia.website
many many many Varia's websites, work in progress: https://many.vvvvvvaria.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
657 B
27 lines
657 B
// stars.js
|
|
// Random Stars
|
|
var generateStars = function(){
|
|
|
|
var $galaxy = $(".galaxy");
|
|
var iterator = 0;
|
|
|
|
while (iterator <= 100){
|
|
var xposition = Math.random();
|
|
var yposition = Math.random();
|
|
var star_type = Math.floor((Math.random() * 3) + 1);
|
|
var position = {
|
|
"x" : $galaxy.width() * xposition,
|
|
"y" : $galaxy.height() * yposition,
|
|
};
|
|
|
|
$('<div class="star star-type' + star_type + '"></div>').appendTo($galaxy).css({
|
|
"top" : position.y,
|
|
"left" : position.x
|
|
});
|
|
|
|
iterator++;
|
|
}
|
|
|
|
};
|
|
|
|
generateStars();
|