After Effects CC – Expression – Counter

Expression that allows to have a parametrized counter with some extra functionalities.

How to use it

Insert the expression in the text field and add two markers to delimitate the start and the end of it..

Functions

  • Prefix and sufix (ex:  €)

Versions

  •  1.0 [12/05/2016]
  • 0.5 [02/05/2016]

Notes

  • max number:  999.999.999
/*
* Count Expression
* Version: 1.0 [12/05/2016]
* Notes: The layer needs two markers to define the range
*/

//Expression config (Edit)
	startCount = 0;
	endCount = 9000; //max 999.999.999
	decimalPoint = true;
	decimalSimbol = ".";
	prefix = "";
	sufix = "";

//Expression (Do not edit)
	if(marker.numKeys==2){
		countDur = Math.abs(marker.key(1).time - marker.key(2).time);
		t = time - marker.key(1).time;//Start time
		currentValue = prefix + easeOut(t,0,countDur,startCount,endCount).toFixed(0) + sufix;
		if(decimalPoint==true){
			if (currentValue.length > 6){
				currentValue.substr(0,currentValue.length-6) + decimalSimbol + currentValue.substr(-6,3) + decimalSimbol + currentValue.substr(-3,3);
			}else if (currentValue.length > 3) {
				currentValue.substr(0,currentValue.length-3) + decimalSimbol + currentValue.substr(-3,3);
			}else{
				currentValue;
			}
		}else{
			currentValue;
		}
	}else if(marker.numKeys!=2){
		currentValue="2 markers are needed";
	}

Insert an empty space between else if,  if not it will give an error. I’m trying to fix this wordpress bug.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Start typing and press Enter to search

WindTurbine 360