Tuesday, November 20, 2018

Calculating Comp Size (Top Right Anchor)

Layer had a pan on it.  Final keyframes for 1920,1080 layer:
     anchor = 1531.5, 387.7
     pos = 53, 653.5
     scale = 156.3, 156.3

To calculate comp size:

a=transform.anchorPoint; s=transform.scale; p=transform.position;
x= a[0]*s[0]/100 - p[0] + 1920;
y=((1080-a[1])*s[1]/100)+p[1];
[x,y]

Compsize = [4260.4, 1735.4]

Tuesday, October 30, 2018

AE Scripting - UI Elements

Tabbed Panel

Data.defaultRButtonValue = true;
Data.defaultEditText = "EditText Example";

function DW_ScriptName_buildUI(thisObj) {
     var pal = (thisObj instanceof Panel) ? thisObj :
          new Window("palette", Data.scriptName, undefined, {resizeable:true});
     if (pal != null) {
            var tpanel =pal.add ("tabbedpanel"); 
                tpanel.alignChildren = ["fill", "fill"];   
                tpanel.preferredSize = [350,300]; 
               
//////////////  FIRST TAB
     var firsttab = tpanel.add ("tab", undefined, "First Tab")
                firsttab.alignChildren = "fill";
     var firsttab_options = firsttab.add ("panel", undefined, "Options");
                firsttab_options.alignChildren = "left";
                firsttab_options.orientation = "column";
     firsttab_options.firstgroup = firsttab_options.add ("group");
                firsttab_options.firstgroup.alignChildren  = "left";
                firsttab_options.firstgroup.alignment = ['left','center']; 
                firsttab_options.firstgroup.orientation = "row";
     firsttab_options.firstRButton =
          firsttab_options.firstgroup.add ("RadioButton", undefined, "1st Radio Button:"); 
               firsttab_options.firstRButton.alignment = ['left', 'center'];
     firsttab_options.secondRButton =  firsttab_options.firstgroup.add ("RadioButton", undefined, "2nd Radio Button:"); 
          firsttab_options.rButtonAddToShapeLayer.alignment = ['left', 'center'];
          firsttab_options.firstgroup.value = Data.defaultRButtonValue;

     firsttab_options.textGroup = firsttab_options.add ("group");  
                    firsttab_options.textGroup.alignChildren  = "left";
                    firsttab_options.textGroup.alignment = ['left','center']; 
                    firsttab_options.textGroup.orientation = "row";
     firsttab_options.statictext = firsttab_options.textGroup.add ("StaticText", undefined, "StaticText To Display");
                    firsttab_options.textGroup.alignment = ['left','center'];
            firsttab_options.editabletext = firsttab_options.textGroup.add ("EditText", undefined, Data.defaultEditText);  
                    firsttab_options.editabletext.characters = 27;

     // Workaround to ensure the edittext text color is black, even at darker UI brightness levels
var winGfx = pal.graphics;
var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
//firsttab_options.shapeName.foregroundColor = darkColorBrush;

pal.layout.layout(true);
pal.layout.resize();
pal.onResizing = pal.onResize = function () {this.layout.resize();
}

Wednesday, August 22, 2018

Touch Designer - Setting Bypass and Cooking

How to bypass:
op('OPNAME').bypass = True
op('OPNAME').bypass = False

Cooking flag:
op('OPNAME').allowCooking = True
op('OPNAME').allowCooking = False

Other flags can be found under "Common flags" section here:
http://www.derivative.ca/wiki088/index. ... COMP_Class

Monday, August 20, 2018

Touch Designer Tips - importing Shadertoy GLSL shaders

replace iChannel0 with     sTD2DInputs[0]
replace fragCoord with     gl_FragCoord.xy

Add 2 Vector variables:
iResolution [1280, 720]
iTime [absTime.seconds]

uniform vec2 iResolution;
uniform float iTime;

============================================
Dual Buffer

replace iChannel0 with   sTD2DInputs[0]
replace void mainImage(out vec4 fragColor,etc) with     void main()

layout (location = 0) out vec4 fragColor;
uniform vec3 iResolution;
uniform float iFrame;
uniform vec3 iMouse;




https://www.youtube.com/watch?v=2JDR5l5UjRU

Tuesday, May 15, 2018

Houdini - VEX samples

//CREATE LINE WITH MULTIPLE POINTS
int pointCount = chi("Point_Count");
int points[];

resize(points, pointCount);

for   (int i=0; i < pointCount; i++)
{
    vector curPos = set(0,i,0);
    int curPointId = addpoint(geoself(), curPos);
    points[i] = curPointId;
    }

for(int i=0; i<pointCount-1; i++;
{
    addprim(geoself(), "polyline", points[i], points[i+1]);
    }

//addprim(geoself(), "polyline", points);

===========================================================================
//RECREATING LINE NODE
float length = ch("Length");
int pointCount = chi("Points");
vector dir = chv("Division");
vector offset = chv("Offset");

dir = normalize(dir);
int points[];
resize(points, pointCount);

float stepVal = length/(float)(pointCount-1);

for(int i=0; i<pointCount; i++)
{
    vector pointPos = (dir) * (stepVal*i) + offset;
    int cutID = addpoint(geoself(), pointPos);
    points[i] = curID;
    }

addprim(geoself(), "polyline", points);
===========================================================================

Wednesday, May 2, 2018

AE - PointAt

1) Create 3 nulls: Null_PointAt, Null_Base, Null_Target
2) Set the following transform expressions on Null_PointAt:

Position:
thisComp.layer("Null_Base").transform.position

Scale:
point1 = thisComp.layer("Null_Base").transform.position;
point2 = thisComp.layer("Null_Target").transform.position;
scl=length(point1, point2);
[scl, scl]

Rotation:
fromPoint = thisComp.layer("Null_Base").transform.position;
atPoint = thisComp.layer("Null_Target").transform.position;
Pointer3=lookAt(fromPoint, atPoint);
if(atPoint[1]<fromPoint[1]) [Pointer3[1]]-180; else [-Pointer3[1]];