I am creating a particle system and I am trying to generate the particles / CreateChildSymbol on the top left bottom right edges of the window/stage?
Currently I am generating random X & Y points but thats not really doing what I need.
// find the stage width & height | ||
sym.maxWidth = $('#Stage').width(); | ||
sym.maxHeight = $('#Stage').height(); |
// randomize the numbers 1-12 | ||
var randomSymbol = Math.floor((Math.random()*12)+1); |
// Pull symbol from lib and add to stage | ||
sym.mainParticle = sym.createChildSymbol("symbol_ani_" + randomSymbol, "Stage"); |
// create jQuery object / Edge Ani element var | ||
sym.mainParticleElement = sym.mainParticle.getSymbolElement(); |
| |||
var randomX = Math.floor(Math.random() * sym.maxWidth); | |||
var randomY = Math.floor(Math.random() * sym.maxHeight); |
// position based on random stage X + Y position | ||
sym.mainParticleElement.css({'position':'absolute','top':randomY+'px', 'left':randomX+'px'}); |
But I am at a loss of how to randomize the top / right / bottom / left X & Y edges of the stage