Skip to content

Instantly share code, notes, and snippets.

@yone80
yone80 / Extract Edge Groups
Created September 3, 2017 09:30
VEXpression
string edgegrp = chs('edge_group');
string newgrpname = chs('new_polyline_group_name');
int edges[] = expandedgegroup(0, edgegrp);
int prevpt = -1;
int curprim = -1;
for(int i=0; i<len(edges); i+=2)
{
@yone80
yone80 / shapeonpath.js
Last active October 25, 2017 11:51
Shape on path - Aftereffects Expression
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();
@yone80
yone80 / circleshape.js
Created October 23, 2017 14:10
Circle shape - Aftereffects Expression
seg = Math.floor( Math.max(effect("Segments")("Slider"), 2) );
radius = effect("Radius")("Slider");
angle_param = clamp(effect("Angle Control")("Angle"), -360, 360);
close = effect("Close")("Checkbox") > 0;
angle = degreesToRadians(angle_param) * 1 / seg;
tangent = [0, 4 / 3 * Math.tan(angle/4) ] * radius;
firsttangent = [0,0];
numiterations = seg + 1;
@yone80
yone80 / shapeonmotionpath
Last active November 8, 2017 00:19
Shape on motion path - Aftereffects Expression
seg = Math.floor( Math.max(effect("Segments")("Slider"), 2) );
starttime = effect("Start Time")("Slider");
endtime = effect("End Time")("Slider");
smooth = effect("Smooth")("Checkbox") > 0;
targetlayer = thisComp.layer("Tip");
timemin = Math.min(starttime, endtime);
timemax = Math.max(starttime, endtime);
cv = [];
@yone80
yone80 / roll.js
Last active August 21, 2018 10:21
Roll - Aftereffects Expression
numsegments = Math.max(2, Math.floor(effect("Segments")("Slider")));
totallength = Math.max(0.001, effect("Line Length")("Slider"));
seglength = totallength / numsegments;
sepdist = Math.max(0.001, effect("Seperation Distance")("Slider") * 0.5) / (Math.PI * 2);
roll = clamp(effect("Roll")("Slider"), 0, 1);
pos = [0, 0];
cv = [];
firsttheta = Math.sqrt(numsegments * seglength / sepdist);