1

I'm having a little problem i can't seem to resolve efficiently.

Right now I'm using a common expression with slider control to create a simple counter, with a "$" attached next to it:

Math.round(effect("Slider Control")("Slider")) + "$";

So, for example, if my number starts at 0 and ends at 50000, then the "$" will have moved a few spaces to the right, like this:

enter image description here

As you can see, the "$" moves back and forth while the number changes and then it ends more to the right because the number increased.

This happens automatically attaching "$" to the expression. I want to achieve the same but with a little image. Lets say that instead of a $ sign i want to attach a little image of a coin, or a gem, etc, and i want it to move accordingly next to the number when it increases.

enter image description here

On an ideal world, there would exist some way to call the image directly inside the expression, like ' + "image path"; '

enter image description here

but that's not the case here i guess 😃

-Please ignore the next paragraphs if you have a better idea-

I though about adding a dot or something next to the number, and then track the movement it does (because it will move when the number grows bigger) so i could later attach it to a null object and finaly link the null object with the image, but that idea has 2 problems:

1) i can't track my text layer, it seems after effects only lets you make trackings of places inside a video file and

2) i would have to be extra careful covering the dot/symbol i will be using the tracking over. Sometimes the image won't be a coin, and it may present obstacles for covering it properly

I'm really looking forward to your suggestions and sorry for my grammar mistakes, i'm not a native english speaker.

Thanks in advance!

1

I think I managed to do it, use the following script on the image you want to be moved with text. Place the expression on the Position.

text_width = thisComp.layer("Text_Layer").sourceRectAtTime().width; thisComp.layer("Text_Layer").transform.position + text_width

enter image description here

  • Hi, thanks for your answer! The expression didn't work, it just fixed the image to the right of the text layer, and a bit below, but it didn't move accordingly to the number changing. It stayed still – Pachu Nov 23 '17 at 20:00
  • Hi again, i just discovered that your expression works if i change the numbers manually (if i write or remove characters from the text layer myself), but not when the characters change using the slider control, did you try it when the slider control changes the width of the text layer? – Pachu Nov 23 '17 at 21:40
  • Yes, my number was dynamic and changed according to the expression slider. Can you show me your project so I can see it. Also which version of AE are u using? – Mamoon Nov 24 '17 at 14:02
  • Maybe that your layers IN points are not at the same position? If that the case then you need to add an argument inside the brackets for "sourceRectAtTime()" to sync the time. Let me know so we can solve this. – Mamoon Nov 24 '17 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.