Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hankpillow/scale-to-fit
small actionscript library which scales an object in order to fit another object's size.
https://github.com/hankpillow/scale-to-fit
Last synced: 2 months ago
JSON representation
small actionscript library which scales an object in order to fit another object's size.
- Host: GitHub
- URL: https://github.com/hankpillow/scale-to-fit
- Owner: hankpillow
- Created: 2011-02-18T19:33:54.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-15T18:10:40.000Z (about 13 years ago)
- Last Synced: 2024-08-03T05:05:33.709Z (6 months ago)
- Language: ActionScript
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-actionscript-sorted - scale-to-fit - small actionscript library which scales an object in order to fit another object's size. (Unsorted / Other API)
README
# 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](http://labs.influxis.com/?p=6)
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} );