[go: up one dir, main page]

Skip to content

small actionscript library which scales an object in order to fit another object's size.

Notifications You must be signed in to change notification settings

hankpillow/scale-to-fit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About:

This is just a very simple class which does scaling objects keeping their proportion.

The good stuff is that this class can scale properly your object by cropping (using the lower value) it or just fitting by the highest dimension.

The class API was designed to be ease and intuitive.

##Simple fit:##

resize(a).toFitIn(b);

##Crop:##

Resize by the lower dimension:

resize(a).toFitIn(b, true);

##Multipliers##

In case of resizing videos this link has a good explanation about how important is keeping the proper dimension in videos:

resize(a).multipleOf( 16 ).toFitIn(b);

##Tweening##

If you are that guy who loves doing this scale using "tween", I did a method for you:

var r : Rectangle = resize(a).simulate().toFitIn(b).bounds;
Tweener.addTween( a, {width:r.width, height:r.height, time:0.5} );

About

small actionscript library which scales an object in order to fit another object's size.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published