Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HDrawablePool pool;
- HColorPool colors;
- float sz;
- int _cols, _rows;
- int numElem;
- void setup(){
- size(900,600);
- smooth();
- colors = new HColorPool(#D1DBBD, #91AA9D, #3E606F, #193441);
- //colors = new HColorPool(#F28F15, #F25C0A, #BF2705, #730502);
- draw_grid();
- }
- void draw() {
- }
- void draw_grid() {
- H.init(this).background(#FFFFFF).autoClear(true);
- sz = 50;
- //float cell = sz + 10;
- float cell = 40;
- float _startX = cell;
- float _startY = cell;
- _cols = int(width/cell)-1;
- _rows = int(height/cell)-1;
- numElem = int(_cols*_rows);
- pool = new HDrawablePool(numElem);
- pool.autoAddToStage()
- .add(new HRect())
- .layout(
- new HGridLayout()
- .startX(_startX)
- .startY(_startY)
- .spacing(cell,cell)
- .cols(_cols)
- )
- .onCreate(
- new HCallback() {
- public void run(Object obj) {
- HRect d = (HRect) obj;
- d
- .rounding(5)
- .anchorAt(H.CENTER)
- .strokeWeight(1)
- .stroke(0,150)
- .fill(colors.getColor(),150)
- .size(sz)
- .rotate( 45 )
- ;
- }
- }
- )
- .requestAll()
- ;
- H.drawStage();
- }
- void mouseClicked() {
- draw_grid();
- //save(random(1234)+".png");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement