perspective

Here is some code for finding the right ratio of size to distance in perspective. You can also use it for movement as the dif variable is used for in the box movie clip.

maths illustration

It doesn’t seem to matter that the triangle s,P,(x) isn’t right angled. It is only the difference between the angles that’s needed.

var a = 40;
var r = 90;
var s = 20;
var t = 180-(a+r+s);
var N = 40;
var g = 180-(a+t);
var h = 30;
for (i=0; i<N; i++) {
var P = 180-(((a/N)*i)+g);
var base = h/(Math.tan(P));
_root.attachMovie(“box”, “box”+i, i);
_root["box"+i]._xscale = base;
_root["box"+i]._yscale = base;
_root["box"+i].id = i;
_root["box"+i].dif = base;
}

Click here for the link to the swf

and here to download th fla file

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.