Skip to content

Instantly share code, notes, and snippets.

@eeropic
Last active June 12, 2024 10:23
Show Gist options
  • Save eeropic/eea5c38887178b1756d99da453e4977f to your computer and use it in GitHub Desktop.
Save eeropic/eea5c38887178b1756d99da453e4977f to your computer and use it in GitHub Desktop.
After effects expressions and scripts collected from various authors and myself.
//dynamic parenting for 3d layers
//from Dan Ebberts on forums I think..
//Position
L=thisComp.layer("Object center");
L.toWorld(L.effect(name)("3D Point"));
//Scale
L =thisComp.layer("Object center");
[L.transform.scale[0]/100*value[0],L.transform.scale[1]/100*value[1],L.transform.scale[2]/100*value[2]];
//Orientation
L = thisComp.layer("Object center");
u = fromWorldVec(L.toWorldVec([1,0,0]));
v = fromWorldVec(L.toWorldVec([0,1,0]));
w = normalize(fromWorldVec(L.toWorldVec([0,0,1])));
sinb = clamp(w[0],-1,1);
b = Math.asin(sinb);
cosb = Math.cos(b);
if (Math.abs(cosb) > .0005){
c = -Math.atan2(v[0],u[0]);
a = -Math.atan2(w[1],w[2]);
}else{
a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);
c = 0;
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]
//from tomas sinkunas
// Apply Pseudo Effect as Animation Preset
// By Tomas Sinkunas (www.rendertom)
/*
Script applies Pseudo Effect as Animation preset, eliminating the need for the end user to install Pseudo Effect to XML and restart AE.
How to make it work:
1. Install Pseudo Effect on your machine.
2. Apply Pseudo Effect to a layer and export it as Animation Preset. Animation Presets are not backwards compatible, so use as lowest AE version as you can.
3. Convert exported FFX file to binary string and paste it to myPseudoEffect.presetBinary property.
4. Done. Your clients dont need to install Pseudo Effect as it will be applied ad Animation Preset. Enjoy.
*/
myAwesomeScript();
function myAwesomeScript() {
// Define your Pseudo Effect here
var myPseudoEffect = {
matchName : null,
presetName : "Scribe.ffx",
presetBinary: ["RIFX\x00\x00\x11\u00D4FaFXhead\x00\x00\x00\x10\x00\x00\x00\x03\x00\x00\x00Q\x00\x00\x00\b\x00theLIST\x00\x00\x11\u00B0bescbeso\x00\x00\x008\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00`\x00\x00\x18\x00\x00\x00\x00\x00\x04\x00\x01\x00\x01\x07\u0080\x048?\u00F0\x00\x00\x00\x00\x00\x00@$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00FF\u00FF\u00FF\u00FFLIST\x00\x00\x00\u00ACtdsptdot\x00\x00\x00\x04\u00FF\u00FF\u00FF\u00FFtdpl\x00\x00\x00\x04\x00\x00\x00\x02LIST\x00\x00\x00@tdsitdix\x00\x00\x00\x04\u00FF\u00FF\u00FF\u00FFtdmn\x00\x00\x00(ADBE Effect Parade\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00@tdsitdix\x00\x00\x00\x04\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdsn\x00\x00\x00\x07Scribe\x00\x00LIST\x00\x00\x00dtdsptdot\x00\x00\x00\x04\u00FF\u00FF\u00FF\u00FFtdpl\x00\x00\x00\x04\x00\x00\x00\x01LIST\x00\x00\x00@tdsitdix\x00\x00\x00\x04\u00FF\u00FF\u00FF\u00FFtdmn\x00\x00\x00(ADBE End of path sentinel\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x104sspcfnam\x00\x00\x000Scribe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x06pparTparn\x00\x00\x00\x04\x00\x00\x00\btdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0000\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00sitd\u00DE\b_\u00BF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00FF\u00FF\u00FF\u00FF\u00FF\x7F\x00\x00\\\u0090\u00D3\u0089\u00FF\x7F\x00\x00ww\u00BF_tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05Color\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00sitd\u00DE\b_\u00BF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00FF\u00FF\u00FF\u00FF\u00FF\x7F\x00\x00\\\u0090\u00D3\u0089\u00FF\x7F\x00\x00ww\u00BF_tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0002\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nThickness\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Dz\x00\x00\x00\x00\x00\x00B\u00C8\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ww\u00BF_tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0003\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\rTrim\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0004\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nStart\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0080\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0080\x00\x00\x00B\u00C8\x00\x00\x00\x00\x00\x00B\u00C8\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0005\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nEnd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@Y\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B\u00C8\x00\x00\x00\x00\x00\x00B\u00C8\x00\x00B\u00C8\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0006\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nOffset\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00C4z\x00\x00Dz\x00\x00\u00C2\u00C8\x00\x00B\u00C8\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0007\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pard\x00\x00\x00\u0094\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x0E\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\t`tdgptdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x07Scribe\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0000\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00DAtdbstdsb\x00\x00\x00\x04\x00\x00\x00\x03tdsn\x00\x00\x00\x01\x00\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0080\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdpi\x00\x00\x00\x04\x00\x00\x00&tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x01\ntdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x06Color\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x04\x00\x07\x00\x01\x00\x02\u00FF\u00FF\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00`@o\u00E0\x00\x00\x00\x00\x00@o\u00E0\x00\x00\x00\x00\x00@o\u00E0\x00\x00\x00\x00\x00@o\u00E0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0002\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00F6tdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\nThickness\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\u00FF\u00FF\u00FF\u00FF\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdum\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00tduM\x00\x00\x00\b@Y\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0003\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00D2tdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x05Trim\x00\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0080\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0004\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00F2tdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x06Start\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\u00FF\u00FF\u00FF\u00FF\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\u0080\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdum\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00tduM\x00\x00\x00\b@Y\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0005\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00F0tdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x04End\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\u00FF\u00FF\u00FF\u00FF\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(@Y\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdum\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00tduM\x00\x00\x00\b@Y\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0006\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00F4tdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x07Offset\x00\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\u00FF\u00FF\u00FF\u00FF\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdum\x00\x00\x00\b\u00C0Y\x00\x00\x00\x00\x00\x00tduM\x00\x00\x00\b@Y\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(Pseudo/9db0uID/Scribe-0007\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00LIST\x00\x00\x00\u00CEtdbstdsb\x00\x00\x00\x04\x00\x00\x00\x01tdsn\x00\x00\x00\x01\x00\x00tdb4\x00\x00\x00|\u00DB\u0099\x00\x01\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00`\x00?\x1A6\u00E2\u00EB\x1CC-?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00?\u00F0\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0080\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00cdat\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tdmn\x00\x00\x00(ADBE Group End\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00pgui\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00<?xpacket begin=\"\u00EF\u00BB\u00BF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 5.3-c011 66.146227, 2012/04/10-09:44:09 \">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n <dc:format>application/vnd.adobe.aftereffects.preset-animation</dc:format>\n </rdf:Description>\n <rdf:Description rdf:about=\"\"\n xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n <xmp:CreatorTool>Adobe After Effects CS6 (Macintosh)</xmp:CreatorTool>\n <xmp:CreateDate>2016-07-16T23:22:44+03:00</xmp:CreateDate>\n <xmp:MetadataDate>2016-07-16T23:22:44+03:00</xmp:MetadataDate>\n <xmp:ModifyDate>2016-07-16T23:22:44+03:00</xmp:ModifyDate>\n </rdf:Description>\n <rdf:Description rdf:about=\"\"\n xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\"\n xmlns:stEvt=\"http://ns.adobe.com/xap/1.0/sType/ResourceEvent#\">\n <xmpMM:InstanceID>xmp.iid:02801174072068118A6DD39CD982CFC0</xmpMM:InstanceID>\n <xmpMM:DocumentID>xmp.did:02801174072068118A6DD39CD982CFC0</xmpMM:DocumentID>\n <xmpMM:OriginalDocumentID>xmp.did:02801174072068118A6DD39CD982CFC0</xmpMM:OriginalDocumentID>\n <xmpMM:History>\n <rdf:Seq>\n <rdf:li rdf:parseType=\"Resource\">\n <stEvt:action>created</stEvt:action>\n <stEvt:instanceID>xmp.iid:02801174072068118A6DD39CD982CFC0</stEvt:instanceID>\n <stEvt:when>2016-07-16T23:22:44+03:00</stEvt:when>\n <stEvt:softwareAgent>Adobe After Effects CS6 (Macintosh)</stEvt:softwareAgent>\n </rdf:li>\n </rdf:Seq>\n </xmpMM:History>\n </rdf:Description>\n </rdf:RDF>\n</x:xmpmeta>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n<?xpacket end=\"w\"?>"]
}
var myComp = app.project.activeItem;
if (!myComp || !(myComp instanceof CompItem)) {
myComp = app.project.items.addComp("My Comp", 1920, 1080, 1, 10, 24);
myComp.openInViewer();
}
var myLayer = myComp.selectedLayers[0];
if (!myLayer)
myLayer = myComp.layers.addSolid([0,0,0], "My Layer", myComp.width, myComp.height, 1);
var effectsProp = myLayer.property("ADBE Effect Parade");
// APPLY PSEUDO EFFECT
if (effectsProp.canAddProperty(myPseudoEffect.matchName)) {
effectsProp.addProperty(myPseudoEffect.matchName);
} else {
applyPseudoEffect(myPseudoEffect, effectsProp);
}
///// HELPER FUNCTIONS /////
function applyPseudoEffect(myPseudoEffect, effectsProp) {
var userDataFolder = getUserDataFolder();
var animationPreset = createResourceFile(myPseudoEffect.presetName, myPseudoEffect.presetBinary, userDataFolder);
var masterLayer = effectsProp.parentProperty;
var curentComp = masterLayer.containingComp;
var tempSolid = curentComp.layers.addSolid([0,0,0], "Temp Solid", 10, 10, 1);
var tempSolidSource = tempSolid.source;
var tempSolidFolder = tempSolidSource.parentFolder;
tempSolid.applyPreset(File(animationPreset));
myPseudoEffect.matchName = tempSolid.property("ADBE Effect Parade").property(1).matchName;
masterLayer.selected = true;
effectsProp.addProperty(myPseudoEffect.matchName);
tempSolidSource.remove();
if (tempSolidFolder.numItems === 0) tempSolidFolder.remove();
}
function getUserDataFolder() {
try {
var userDataFolder = Folder.userData;
var aescriptsFolder = Folder(userDataFolder.toString() + "/Aescripts/test/");
if (!aescriptsFolder.exists) {
var checkFolder = aescriptsFolder.create();
if (!checkFolder) {
alert ("Error creating \"" + checkFolder.fsName + "\nPlease check the permissions for this folder:\n" + userDataFolder + "\n\nA temp folder will be used instead");
aescriptsFolder = Folder.temp;
}
}
return aescriptsFolder.toString();
} catch(err) {
alert("Permissions issue with user data folder\nPlease give AE full read and write permissions to the ~/Library/Application Support/Aescripts/test folder.");
}
}
function createResourceFile (filename, binaryString, resourceFolder) {
try {
var myFile = new File(resourceFolder + "/" + filename);
if (!File(myFile).exists) {
if (!(isSecurityPrefSet())) {
alert ("This script requires access to write files.\n" +
"Go to the \"General\" panel of the application preferences and make sure\n" +
"\"Allow Scripts to Write Files and Access Network\" is checked.");
app.executeCommand(2359);
if (!isSecurityPrefSet()) return null;
}
myFile.encoding = "BINARY";
myFile.open( "w" );
myFile.write( binaryString );
myFile.close();
}
return myFile;
} catch(err){
alert("Error in createResourceFile function\n" + err.toString());
}
}
function isSecurityPrefSet(){
try {
var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY");
return (securitySetting == 1);
} catch(err){
alert("Error in isSecurityPrefSet function\n" + err.toString());
}
}
}
//from Paul Conigliaro
/********************************
Path Length
Writes the length of the first selected path to the Info panel
and copies result to clipboard
********************************/
{
var thisComp = app.project.activeItem;
var thisShape = thisComp.selectedProperties[0];
try{
var pathLength = Math.round(getPathLength(thisShape.property("Path").value)*100)/100;
if($.os.indexOf("Macintosh") === -1) { var cmdString = 'cmd.exe /c cmd.exe /c "echo ' + pathLength + ' | clip"'; }
else { var cmdString = 'echo "' + pathLength + '" | pbcopy'; }
system.callSystem(cmdString);
clearOutput();
writeLn("Path Length: " + pathLength + " pixels.");
//Uncomment this line to display alert instead.
//alert("Path Length: " + pathLength + " pixels.");
} catch(e){
alert("ERROR: Did you select only paths?");
}
function getPathLength(shapePath) {
var len = 0;
var verts = shapePath.vertices;
var numVerts = verts.length;
var ins = shapePath.inTangents;
var outs = shapePath.outTangents;
for (var i = 0; i < numVerts-1; i++) { len += getCurveLength(verts[i],verts[i+1],outs[i],ins[i+1]); }
if(shapePath.closed == true) { len += getCurveLength(verts[numVerts-1],verts[0],outs[numVerts-1],ins[0]);}
return len;
//Curve Segement Length function from Hernan Torrisi
function getCurveLength(initPos, endPos, outBezier, inBezier) {
var k, curveSegments = 100, point, lastPoint = null, ptDistance, absToCoord, absTiCoord, triCoord1, triCoord2, triCoord3, liCoord1, liCoord2, ptCoord, perc, addedLength = 0, i, len;
for (k = 0; k < curveSegments; k += 1) {
point = [];
perc = k / (curveSegments - 1);
ptDistance = 0;
absToCoord = [];
absTiCoord = [];
len = outBezier.length;
for (i = 0; i < len; i += 1) {
if (absToCoord[i] === null || absToCoord[i] === undefined) {
absToCoord[i] = initPos[i] + outBezier[i];
absTiCoord[i] = endPos[i] + inBezier[i];
}
triCoord1 = initPos[i] + (absToCoord[i] - initPos[i]) * perc;
triCoord2 = absToCoord[i] + (absTiCoord[i] - absToCoord[i]) * perc;
triCoord3 = absTiCoord[i] + (endPos[i] - absTiCoord[i]) * perc;
liCoord1 = triCoord1 + (triCoord2 - triCoord1) * perc;
liCoord2 = triCoord2 + (triCoord3 - triCoord2) * perc;
ptCoord = liCoord1 + (liCoord2 - liCoord1) * perc;
point.push(ptCoord);
if (lastPoint !== null) {
ptDistance += Math.pow(point[i] - lastPoint[i], 2);
}
}
ptDistance = Math.sqrt(ptDistance);
addedLength += ptDistance;
lastPoint = point;
}
return addedLength;
}
}
}
//from Satoru Yonekura
dist = effect(“Offset”)(“Slider”); // Position on path.
w = effect(“Width”)(“Slider”); // Normal direction width.
restpath = thisProperty;
targetpath = thisComp.layer(“Path”).content(“Shape 1”).content(“Path 1”).path; // Target Path
refpt = restpath.points();
refintan = restpath.inTangents();
refouttan = restpath.outTangents();
points =[];
intangents = [];
outtangents = [];
for(i=0; i<refpt.length; i++){
rest = refpt[i];
f = dist + rest[0] / thisComp.width;
pathpoint = targetpath.pointOnPath(f);
pathnormal = targetpath.normalOnPath(f);
angle = Math.atan2(-pathnormal[0], pathnormal[1]);
intanx = refintan[i][0] * Math.cos(angle) – refintan[i][1] * Math.sin(angle);
intany = refintan[i][0] * Math.sin(angle) + refintan[i][1] * Math.cos(angle);
outtanx = refouttan[i][0] * Math.cos(angle) – refouttan[i][1] * Math.sin(angle);
outtany = refouttan[i][0] * Math.sin(angle) + refouttan[i][1] * Math.cos(angle);
points.push( pathpoint + pathnormal * rest[1] *w);
intangents.push( [intanx, intany * w] );
outtangents.push( [ outtanx, outtany * w] );
}
createPath(points, intangents, outtangents);
//Stagger mask or shape layer path points expression by @eeropic
//Apply to a mask or shape "Path" property
var len=points().length;
var pointDelay=framesToTime(2);
var newPoints=[], newInTangents=[], newOutTangents=[];
for(var i=0;i<len;i++){
//increase index count in both directions from first vertex
var pointIndex = ( len / 2 ) - Math.abs( i - ( len/2 ) );
var staggerTime = time - pointDelay * pointIndex;
newPoints.push( points( staggerTime )[i] );
newInTangents.push( inTangents( staggerTime )[i] );
newOutTangents.push( outTangents( staggerTime )[i] );
}
createPath(newPoints,newInTangents,newOutTangents,true)
//Create "vector smear" for a single point motion path expression by @eeropic
//You need 2 layers
//1. A layer with keyframed motion (preferably a circle)
//2. A shape layer below with a stroked vector path with this expression applied
//to the "Path" property
var pts=[], inTangents=[],outTangents=[];
//Reference to the layer with keyframed motion, currently pointing to the layer above
var ref=thisComp.layer(index-1);
var averageSpeed=0;
for(var i=0;i<5;i++){
averageSpeed+=ref.position.speedAtTime(time+framesToTime(i-2));
}
averageSpeed=averageSpeed/5;
var spd=Math.max(1,averageSpeed/180);
for(var i=-spd/2;i<spd/2;i++){
timePos=time-i/120;
pts.push(ref.position.valueAtTime(timePos));
var inTangent=div(ref.position.velocityAtTime(timePos),360);
var outTangent=mul(inTangent,-1);
inTangents.push(inTangent);
outTangents.push(outTangent);
}
createPath(pts,inTangents,outTangents,false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment