Copy link to clipboard
Copied
Hi,
I'm having a bit of trouble figuring this one out. Hoping someone can help. I have a text layer with the animator "Character Value" being used. I'd like to attach a slider so that it toggles the character value to specific numbers. For example, using the slider, only these numbers "39, 45, 58, 61, 95, 96, 124, 168" will be appear or be input into the number field for "Character Value". Basically, with the slider, you can toggle and choose which value to use. I'd be very grateful if anyone can help. Thank you.
Francis
Hi Francis,
I think I understand what you are trying to achieve and I have opted for a different solution. I've outlined what I did below but glossed over the why. If this doesn't work or you would like any of this explained further please let me know.
Michael
1. Create an Adjustment layer and add a Slider Control effect.
2. Create a text layer and input a single character.
3. To the text layer, from the Animate flyout menu add Character Value.
4. To the text layer, add an expression to the Character
...Copy link to clipboard
Copied
Hi Francis,
I think I understand what you are trying to achieve and I have opted for a different solution. I've outlined what I did below but glossed over the why. If this doesn't work or you would like any of this explained further please let me know.
Michael
1. Create an Adjustment layer and add a Slider Control effect.
2. Create a text layer and input a single character.
3. To the text layer, from the Animate flyout menu add Character Value.
4. To the text layer, add an expression to the Character Value and paste the following code…
var theMatrix = [39,45,58,61,95,96,124,168];
var theSlider = thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider");
var theMatrixPosition = Math.floor( (theSlider/100) * (theMatrix.length - 1) );
theMatrix[theMatrixPosition];
Dragging the Slider Control on the Adjustment layer will move through all of the values input into the variable called theMatrix. Be sure to keep the slider values between 0 and 100 (inclusive) or you will get an error.
Copy link to clipboard
Copied
That worked beautifully! Thank you.
Copy link to clipboard
Copied
Hey fantastic. Happy to help.
Copy link to clipboard
Copied
I'm trying to do this same thing, but as soon as I put the expression in, my text disappeared. The character value is correct in the properties, but it's invisible in the comp. Also, is there a way to do this where I can show numbers with decimals in them?
Copy link to clipboard
Copied
I just noticed that when I tried the code with the original values, I didn't get numbers, I got characters like apostrophes, colons, and mathematical symbols. Not sure why.
Copy link to clipboard
Copied
Numbers who are in the matrix array are Char Codes
var theMatrix = [39,45,58,61,95,96,124,168];
if you want to display numbers or whatever simply:
- create a text layer with a slider control
- add this expression to the Source Text property:
var array = [3.14, 45, "abc", 61, 95, 96, 124, 168];
var idx = clamp(Math.floor(effect("Slider Control")("Slider")), 0, array.length-1);
array[idx];
Copy link to clipboard
Copied
Michael, Don't use Adjustment Layers for Effects Controls like Slider Control or Dropdown Menu controls. Add your Expression Controls to Nulls or layers with pixels. Adjustment layers are only for Effects, and even if there is nothing on an adjustment layer, AE has to look at it and every pixel that is under it.