Forum Replies Created
-
Oleg Pirogov
March 7, 2019 at 11:49 pm in reply to: How does After Effects calculate or determine a shape layer’s anchor point?Well, apparently that’s how it works.
Shape layer’s boundaries don’t match comp boundaries but it does have the same size: it’s a 1920*1080 rectangle with top-left corner in the center of the comp.BTW, text layer is the same: it has the size of the comp and by default (when you double click on text icon) its top-left corner is in the center of the comp with zero anchor.
I could speculate that layers with variable Source Rectangle like texts and shapes are this way for convenience of dealing with point of origin: if you don’t manually change anchor point it will mark the origin.
Layers with fixed Source Rectangle like solids, nested comps, footages don’t need that cause origin is always marked as Source Rectanlge’s top-left corner.
But those are just my guesses and lyrics.In the end of the day, all layers have it’s origin in their top-left corner and anchor point coordinates are giver with respect to it. The thing that differs is Anchor Point and Position default values.
-
Oleg Pirogov
March 7, 2019 at 12:28 am in reply to: Expression that checks if Effect on another layer is presentSince a reference to non-existent property raises an exception, you can use try-catch:
var someVar;
try{
someVar =thisComp.layer("SOURCE").effect("Face Track Points")("Right Pupil");
}
catch(err){
someVar=[0,0];
} -
The last time I had smth like that was when I had a path value copied to a clipboard.
That is cured by copying anything else to clipboard. -
Perhaps I’m missing something, but is it thisComp you are looking for? Like
if(thisComp.layer("Null 1").effect("Checkbox Control")("Checkbox")> 0) {100} else {0} -
Oleg Pirogov
March 5, 2019 at 1:06 am in reply to: Finding the number of lines in a block of paragraph textThe usual workaround to get the number of lines is to divide sourceRect height by line height: https://forums.creativecow.net/thread/227/40793
But since you are interested in sourceRect itself, you may duplicate your text layer and apply Animator for Character Value = 1 with Expression Selector
textIndex<=4 ? 0 : 100based on lines.What it does is it replaces all characters in lines after [for ex.] 4th with #1 Unicode character which is not displayed in AE (in your system too, hopefully). Effectively it means that only first 4 lines are displayed with sourceRect adjusted accordingly.
-
Yeah, it’s effect(“Slider Control”)(“Slider”).value
This should work:function numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}var num = effect("Slider Control")("Slider").value
num = numberWithCommas(num);
[num] -
Can you post the whole expression?
-
It’s an alternative to your function, so:
function numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}var num = effect("Slider Control")("Slider")
num = numberWithCommas(num);
[num] -
This:
var parts = number.toString().split(".");
gives you an array [‘1213′, ’37’], so you can apply your comma-separating function to parts[0] getting [‘1,213′, ’37’] and then rejoining them with:
parts.join(".");Just for a reference, a regex code which does what you want:
function numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
which I’ve found here: https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript -
Well, cause one of the arguments of * operation ‘must be a scalar’. Smth like that would work in Python but not in Javascript.
[a[0], a[1]]*[1, -1] = [a[0], a[1]*(-1)] is element-wise multiplication. It exists in JS’s as math.dotMultiply(x, y) but is not implemented in AE’s expressions.