Author Topic: Text along a curve  (Read 62221 times)

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Text along a curve
« on: May 15, 2014, 06:46:02 AM »
Text along circle or curve would be really great ... I don't really know if it's the right thread to ask for this.
« Last Edit: May 16, 2014, 05:04:40 PM by Stephan B. »

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #1 on: May 23, 2014, 01:37:07 AM »
Text along circle or curve would be really great ... I don't really know if it's the right thread to ask for this.

Wow! For whatever reason I thought I had answered this. Sorry!

I already have a crude implementation of this that I did a little while back. I had to stop adding features otherwise, I would have never made Beta :)

Here is a quick image of the prototype of this ...

[ Guests cannot view attachments ]

In this image, I simply used 2 Animation Curves (On for Position / Rotation and the other for Scale) to define where the text ends up. What I would like to do is give user the ability to define / draw a spline that the text would follow or a simple functions or a radius ... ie different methods to define the curve or path for the text to follow.

This is definitely in my list of things I want to add :)

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #2 on: May 26, 2014, 12:52:24 AM »
Great ! Take your time, but it definitively add something to your library :D

zipper

  • Beta User
  • Newbie
  • *
  • Posts: 4
Re: Text along a curve
« Reply #3 on: June 17, 2014, 03:45:09 PM »
I was going to post this, but someone beat me to it!!

I would like to add my vote for text along a curve as well.

tayl0r

  • Beta User
  • Newbie
  • *
  • Posts: 13
Re: Text along a curve
« Reply #4 on: November 04, 2014, 03:36:13 PM »
me 3!

iByte

  • Beta User
  • Newbie
  • *
  • Posts: 5
Re: Text along a curve
« Reply #5 on: November 15, 2014, 12:06:25 PM »
+1

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #6 on: February 16, 2015, 06:19:08 AM »
Is this feature in the pipeline?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #7 on: February 16, 2015, 12:25:24 PM »
Is this feature in the pipeline?

It is and there is an example of a potential implementation in the "Demo & Extra Content" package found in the Beta release 0.1.46 B2.4. Look at the vertex animation example in the demo scenes and the warp option. Those scripts haven't been updated since the previous releases so let me know if you run into any issues.

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #8 on: February 17, 2015, 01:08:08 AM »
There are just some renaming to do TextInfo to TMP_TextInfo, WordInfo to TMP_WordInfo, TMPro_CharacterInfo to TMP_CharacterInfo

As my upload is shitty I let you do modifications

EDIT : The examples are great

EDIT 2 : It does not seem to work in TMP_UGui
« Last Edit: February 17, 2015, 01:23:01 AM by hadesfury »

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #9 on: February 20, 2015, 12:52:07 AM »
Is it scheduled to make it works in UGUI?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #10 on: February 20, 2015, 01:13:10 AM »
Is it scheduled to make it works in UGUI?

The warping of the text is done by the example script "VertexAttributeModifier" in IEnumerator AnimateVertexPositionsIII() coroutine which corresponds to the Warp enum. This example uses the TextMeshPro.textInfo class to access the individual characters and mesh information to tweak them. This can easily be modified to do the same but instead of modifying the content of the Mesh Renderer's mesh, you would modify the CanvasRenderer UiVertices.

EDIT I just quickly went ahead an added a revised version "WarpUI" or AnimateUIVertexPositionsIII() which works with the TextMeshProUGUI object. Just create a TMP UI Text object and add that script to it and pick the WarpUI and give it a curve. This is a crude example of how to do it but it can then be revised to do all kinds of vertex attribute modifications using the textInfo class and sub structures.


hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #11 on: February 20, 2015, 01:18:20 AM »
Thx very much

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #12 on: February 20, 2015, 08:57:46 AM »
It seems that the function ForceMeshUpdate does not work as expercted
                int vertexIndex = textInfo.characterInfo.vertexIndex; is always zero

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #13 on: February 20, 2015, 12:14:07 PM »
It seems that the function ForceMeshUpdate does not work as expercted
                int vertexIndex = textInfo.characterInfo.vertexIndex; is always zero

That was a minor omission on my part in Beta 4.1 which I fixed in Beta 4.2.

hadesfury

  • Beta User
  • Full Member
  • *
  • Posts: 133
Re: Text along a curve
« Reply #14 on: February 23, 2015, 03:10:37 AM »
Just for your information, it could be really great if the curve apply along the canvas and not on character ( to have the same curve with any text lenght for example )