gridalicious algorithm as3
- Started
- Last post
- 7 Responses
- KarlFreeman0
Maybe check out bumpslides condensed layout?
- uan0
maybe you can use the treemap algorithm.
there is an opensource flex version aroud:
http://code.google.com/p/flex2tr…
- CyBrain0
Do you have any examples of gridaliciousness?
- meaning a site that has itCyBrain
- http://suprb.com/app…FixMiller
- acescence0
just download the gridalicious theme and convert the javascript to as3. it's not some magical algorithm known all throughout the land, it's just some simple math.
- acescence0
function arrange() {
// how many columns fits here?
var columns = Math.max(MIN_COLS, parseInt($('body').innerWidth() / (COL_WIDTH+GAP)));
$('.eachpost').css('width',COL_W... + 'px');
$('.twocols').css('width', COL_WIDTH*2 + GAP );
$('.threecols').css('width', COL_WIDTH*3 + GAP*2);for (x=0; x < columns; x++) {
maxy[x] = 0;
}// lets iterate over all posts
$('.eachpost').each(function(i) {var pos, cursor, w , altura= 0;
w = (Math.floor($(this).outerWidth() / COL_WIDTH));
cursor = 0;if (w>1) {
for (x=0; x < columns-(w-1); x++) {
cursor = maxy[x] < maxy[cursor] ? x : cursor;
}
pos = cursor;for (var x=0; x<w; x++) {
altura = Math.max(altura, maxy[pos+x]);
}
for (var x=0; x<w; x++)
maxy[pos+x] = parseInt($(this).outerHeight()) + GAP + altura;$(this).css('left', pos*(COL_WIDTH+GAP) + offx).css('top',altura + offy);
}
else {for (x=0; x < columns; x++) {
cursor = maxy[x] < maxy[cursor] ? x : cursor;
}$(this).css('left', cursor*(COL_WIDTH+GAP) + offx).css('top',maxy[cursor] + offy);
maxy[cursor] += $(this).outerHeight() + GAP;
}
});}
- FixMiller0
tnx ascence, just thought it's some algorithm like those ones you learn in advance mathematics. i'll try to convert this.
- acescence0
i found this as3 grid class, might help you out. the site isn't working, but i found the google cache of the page and the download works...