Hi,
I am new here and I currently try to implement my first AE script. I have the following question:
Is there anything similar to the toComp/toWorld functions of expressions in the scripting language? Or do I have to compute the transformations manually step by step? If there do not exist such functions, what is the most elegant way to implement them?
thanks,
Mathias
computation of transformations (toComp, toWorld)
Moderator: Paul Tuersley
mamoworld - tools and tutorials for After Effects
(English and German)
(English and German)
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
I would get the script to temporarily add the expressions and read the values.
Paul
Paul
good idea!
I want to do the computation for mask points (which no expression can be applied to), but I will try to temporarily add a point control effect and insert the expression there.
Seems more like a hack than a proper solution but I guess it should work.
Thank you for the quick help!
I want to do the computation for mask points (which no expression can be applied to), but I will try to temporarily add a point control effect and insert the expression there.
Seems more like a hack than a proper solution but I guess it should work.
Thank you for the quick help!
mamoworld - tools and tutorials for After Effects
(English and German)
(English and German)
I implemented transformation matrices for fast transformations of 2D-Points. It offers also an easy possibility to translate points between layer/and comp-coordinate systems.
If anyone wants to use this in his scripts, you can download it here and include it in your script:
http://www.ps.uni-sb.de/~mmohl/aescript ... s2D.jsxinc
Some example-code of how to use it is also included in the file.
Brief example:
Analogously to the layerToComp there exist also compToLayer and layerToLayer functions as well as functions to perform manual transformations:
If anyone wants to use this in his scripts, you can download it here and include it in your script:
http://www.ps.uni-sb.de/~mmohl/aescript ... s2D.jsxinc
Some example-code of how to use it is also included in the file.
Brief example:
Code: Select all
// transform points A,B and C (must be arrays with 2 elements, representing x and y coordinate)
// transform from layer1-coordinates into composition-coordinates
var transformation = layerToComp(layer1,time);
A= transformation.transform(A);
B= transformation.transform(B);
C= transformation.transform(C);
// A,B and C are now in comp-coordinates
Code: Select all
// rotate A,B and C by 45 degree (clockwise, around (0,0) ), move them afterwards 10 pixels to the right and 5 up and finally scale by a factor of 2 in x-direction
var transformation = rotate(45);
transformation.applyAfter(move([10,-5]));
transformation.applyAfter(scale([2,1]));
A= transformation.transform(A);
B= transformation.transform(B);
C= transformation.transform(C);
// A,B and C are now are rotated, moved and scaled accordingly
mamoworld - tools and tutorials for After Effects
(English and German)
(English and German)
Hi i´m trying to calculate position via script, and toComp still doesnt work in scripting, i have a solution with adding the point position effect and reading value from expression, but if you have still that matrix script, i would really appreciate it.