Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
spoox
Topic Author
Posts: 5
Joined: Tue Sep 16, 2008 4:56 am

Difference between layer.transform.scaling and layer.scaling

Mon Feb 08, 2016 5:16 am

Is there any difference between accessing scaling, position and anchor points via someLayer.transform.* instead of going directly to someLayer.* ?

I had some weird case here where accessing even someLayer.transform.scale[0] would crash AE with an error about it trying to allocate several megabytes of memory, where just doing someLayer.scale[0] would work just fine.

I was doing this in an expression on a layer's .position
 
spoox
Topic Author
Posts: 5
Joined: Tue Sep 16, 2008 4:56 am

Re: Difference between layer.transform.scaling and layer.sca

Mon Feb 08, 2016 5:23 am

FWIW, how to reproduce

1. Create new comp

2. Add an image to it

3. Add this expression to the image's Transform > Position property:

var me = inspect(thisLayer);

function inspect(layer)
{
    var info = {
        layer: layer,
        scaling: { x: layer.transform.scale[0] / 100, y: layer.transform.scale[1] / 100 }, // sometimes this crashes
        position: { x: layer.transform.position[0], y: layer.transform.position[1] }, // usually never crashes
        anchor: { x0: layer.transform.anchorPoint[0], y0: layer.transform.anchorPoint[1] } // this always crashes
    };

    return info;
}

transform.position;



If you remove the .transform part of the lines in inspect() it works just fine.

The reason why I started using .transform.* is because when you add an expression it usually defaults to exactly that (e.g. "transform.position")

Who is online

Users browsing this forum: No registered users and 1 guest