forked from varia/varia.website
Luke Murphy
4 years ago
4 changed files with 563 additions and 566 deletions
File diff suppressed because it is too large
@ -1,27 +1,27 @@ |
|||||
// stars.js
|
// stars.js
|
||||
// Random Stars
|
// Random Stars
|
||||
var generateStars = function(){ |
var generateStars = function () { |
||||
|
var $galaxy = $(".galaxy"); |
||||
|
var iterator = 0; |
||||
|
|
||||
var $galaxy = $(".galaxy"); |
while (iterator <= 100) { |
||||
var iterator = 0; |
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, |
||||
|
}; |
||||
|
|
||||
while (iterator <= 100){ |
$('<div class="star star-type' + star_type + '"></div>') |
||||
var xposition = Math.random(); |
.appendTo($galaxy) |
||||
var yposition = Math.random(); |
.css({ |
||||
var star_type = Math.floor((Math.random() * 3) + 1); |
top: position.y, |
||||
var position = { |
left: position.x, |
||||
"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++; |
|
||||
} |
|
||||
|
|
||||
|
iterator++; |
||||
|
} |
||||
}; |
}; |
||||
|
|
||||
generateStars(); |
generateStars(); |
Loading…
Reference in new issue