这个布局叫什么?实现它的想法?

时间:2010-02-10 10:03:18

标签: flash photos

http://www.uniqlo.com/utzoom/

任何人都知道这种布局/布置是什么样的?

知道如何克制这种随机和动态的东西吗?

1 个答案:

答案 0 :(得分:0)

在Flex中,您可以使用图像处理来达到预期效果 - 请参阅http://www.insideria.com/2008/03/image-manipulation-in-flex.html

private var original:BitmapData;
private static const MAX_WIDTH:uint = 2880;
private static var MAX_HEIGHT:uint = 2880;


private function loadImage(url:String):void
{
 var request:URLRequest = new URLRequest(url);

    var imageLoader:Loader = new Loader();
 imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, image_completeHandler);
    // add other listeners here
    imageLoader.load(request)
}

private function image_completeHandler(event:Event):void
{
    var bmd:BitmapData = Bitmap(event.currentTarget.content).bitmapData;

    var originalWidth:Number = bmd.width;
    var originalHeight:Number = bmd.height;
    var newWidth:Number = originalWidth;
    var newHeight:Number = originalHeight;

    var m:Matrix = new Matrix();

    var scaleX:Number = 1;
    var scaleY:Number = 1;

    if (originalWidth > MAX_WIDTH || originalHeight > MAX_HEIGHT)
    {
        sx =  MAX_WIDTH / originalWidth;
        sy = MAX_HEIGHT / originalHeight;
        var scale:Number = Math.min(sx, sy);
        newWidth = originalWidth * scale;
        newHeight = originalHeight * scale; 
    }
    m.scale(scale, scale);
    original = new BitmapData( newWidth, , newHeight); 

    original.draw(bmd, m);

}

旋转 要使用矩阵旋转图像,您可以创建具有适当参数的新Matrix

var q:Number  = 30 * Math.PI / 180 // 30 degrees in radians

var m:Matrix = new Matrix(Math.cos(q), Math.sin(q), -1 * Math.sin(q), Math.cos(q));

//or as a shortcut use the rotate method

var m:Matrix = new Matrix();

m.rotate(q) ;

当您在Flash Player中旋转某些内容时,它将围绕其注册点旋转。默认情况下,这是左上角。如果你想围绕另一个点旋转它,你需要在负方向上偏移它,做旋转然后把它放回原位。

var m:Matrix = new Matrix();

// rotate around the center of the image

var centerX:Number = image.width / 2;

var centerY:Number = image.height /2;

m.translate(-1 * centerX, -1 * centerY);

m.rotate(q);

m.translate(centerX, centrerY);

翻转 翻转和图像是一个两步过程。第一步是将当前scaleX和/或scaleY乘以-1,第二步是调整x和y位置。当您翻转和图像时,注册点不会改变,并且其绘制方向相反。为了补偿,您需要更改x位置的宽度和y位置的高度。

var m:Matrix = new Matrix();

m.scale(-1, 0); // flip horizontal assuming that scaleX is currently 1

m.translate(image.width, 0); // move its x position by its width to put it in the upper left corner again