Categories
AE

[익스프레션] 포인트 텍스트 색칠하기(끝 점 찾기)

줄바꿈에 상관없이 포인트 텍스트의 끝 점을 찾는다

const pointTextArrayNum = 1;

const startIndex = thisComp.layer("RenderText").text.animator("Animator 1").selector("Range Selector " + pointTextArrayNum).start;
const pointText = thisComp.layer("PointText").text.sourceText.split("$$")[pointTextArrayNum-1];

[(startIndex == -1 || pointText == null) ? 0 : startIndex + pointText.length]
Categories
AE

[익스프레션] 포인트 텍스트 색칠하기(시작점 찾기)

줄바꿈에 상관없이 포인트 텍스트의 위치를 찾는다

const pointTextArrayNum = 1;

const renderText = thisComp.layer("RenderText")
  .text.sourceText.replace(/\r/g, "");
const pointTextArray = thisComp.layer("PointText")
  .text.sourceText.split("$$");


const findStartPositions = (renderText, pointTextArray, curIndex = 0) =>
	pointTextArray.map(pt => {
		const startIndex = renderText.indexOf(pt, curIndex);
		curIndex = (startIndex > 0 ? startIndex : curIndex) + pt.length;
		return startIndex;
	})

result = findStartPositions(renderText, pointTextArray);

[result[pointTextArrayNum-1] ?? -1]