Jump to content
Search Community

Grid building

Luigi Vercotti test
Moderator Tag

Recommended Posts

Hello 

I am using the code from snorkl.tv for grid building.

What I am trying to do is to load the grid (and later to mask but for this moment, the grid is either too big, too small or it does some weird stuff)  to certain movieclip size. I do not know what I am doing wrong.

Let say the container is 400x400px. I did change the code so many times that I was almost crying :-)

I am sure I am doing some simple mistake but what? Please.

I will post the code I started and I've made some changes. The latest code is looking very confusing at this moment :-( 

import com.greensock.*;

//var numTiles:uint = 96;
var numTiles:uint = (container.width / 10)*(container.height / 10);
//var cols:uint = 12;
var cols:uint = container.width / 10;

var rows:uint = numTiles / cols;
//var rows:uint = container.height / 10;

var hspace:uint = 0;
var vspace:uint = 0;

var tl:TimelineMax = new TimelineMax();




for (var i = 0; i< numTiles; i++)
{
	var newTile:Tile = new Tile();
	newTile.width = cols;
	newTile.height = rows;

	var currentCol:uint = i % cols;
	var currentRow:uint = uint(i / cols);

	trace("currentCol: " + currentCol  + "\tcurrentRow: " + currentRow);

	//positioning formula

	newTile.x = newTile.width*.5 + currentCol * (newTile.width + hspace);
	newTile.y = newTile.height*.5 + currentRow * (newTile.height + vspace);

	//newTile.x = newTile.width + currentCol ;
//	newTile.y = newTile.height + currentRow ;


	newTile.scaleX = newTile.scaleY = 0;
	newTile.alpha = 0;

	//TWEEN STYLE FORMULAS: choose ONLY one
	//column by column
	//tl.insert( TweenMax.to( newTile, .5, {scaleX:1, scaleY:1, alpha:1, delay:currentCol * .1}) );

	//row by row
	//tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:currentRow * .1 }) );

	//1 by 1 horizontal
	//tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:i*.02}));

	//1 by 1 vertical
	//tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:((rows * currentCol) + currentRow) *.02 }) );

	//circular
	tl.insert( TweenLite.to( newTile, .5, { scaleX:1, scaleY:1, alpha:1, delay:(newTile.y * newTile.x)*.00001 }) );

	//diagonal top left to bottom right
	//tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay: (currentCol + currentRow)  *  .05  }) );

	//diagonal bottom right to top left

	//tl.insert(TweenLite.to(newTile, .5, {scale:1, alpha:1, delay: ((numTiles/cols + cols -2)- (currentCol + currentRow))  *  .05  }));

	//END TWEEN STYLES

	container.addChild(newTile);

}
Link to comment
Share on other sites

Hi, 

 

I don't know what you mean by "load the grid".

I think it might be best if you started with a simpler example.

 

Perhaps take that snorkl.tv file and strip out everything except what is needed to start off with.

Currently it has a lot of code related to managing a lot of different effects.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...