Shape & Mask Paths

General tips

Maintain stroke width

1
// from campkeyframe
2
sf = transform.scale[0]/100; ov = value; nv = ov / sf
3
​
4
// for parented shapes
5
value / length(toComp([0,0]), toComp([0.7071,0.7071])) || 0.001;
6
​
7
​
8
// https://battleaxe.tumblr.com/post/101945073972/maintain-stroke-weight-expression
Copied!

Looping paths (loopOut() doesn't work for paths)

Pingpong
cycle
1
if (numKeys >1 && time > key(numKeys).time){
2
t1 = key(1).time;
3
t2 = key(numKeys).time;
4
span = t2 - t1;
5
delta = time - t2;
6
seg = Math.floor(delta/span);
7
t = delta%span;
8
valueAtTime((seg%2) ? (t1 + t) : (t2 - t));
9
}else
10
value
Copied!
1
if (numKeys >1 && time > key(numKeys).time){
2
t1 = key(1).time;
3
t2 = key(numKeys).time;
4
span = t2 - t1;
5
delta = time - t2;
6
t = delta%span;
7
valueAtTime(t1 + t)
8
}else
9
value
Copied!

Accessing Shape parameters

Shape Property Group and Index

1
// shape group index
2
thisProperty.propertyGroup(2).propertyIndex // change num accordingly
3
​
4
// using name as index eg. line_1
5
parseInt(thisProperty.propertyGroup(3).name.split("_")[1]); // method 1
6
parseInt(content(1).name.split("_")[1]) // method 2
Copied!
Last modified 6mo ago