开发者

how to bend text in as3?

开发者 https://www.devze.com 2023-02-06 11:00 出处:网络
I have a text \'hello world\' in my ActionScript3 file. What I am trying to achieve is to make the middle portion of the text bigger in height.

I have a text 'hello world' in my ActionScript3 file.

What I am trying to achieve is to make the middle portion of the text bigger in height.

So, it will start off with a small 'h' and then moving towards the middle, each letter's size will increase.

The exact thing is shown in this image -

how to bend text in as3?

http://img180.imagevenue.com/img.php?image=96687_helloworld_122_632lo.jpg

Any ideas how I can achieve this? Than开发者_C百科ks in advance.


Because this has per-glyph distortion, the only way to do it correctly is with a DisplacementMapFilter (which would actually work well with animation too). Here's a good example on how to do that.


You could use drawTriangles from Graphics object. First, create a BitmapData and do a copy of your TextField (enlarged). Then you just have to map your BitmapData to a bended mesh (made of triangles).


If I had to do this, I would put every character in a separate TextField, every TextField in a Sprite, set a proper font size for every character, place the Sprites on proper positions and distort the Sprites using whatever methods you need (Transformation Matrix, 3D, whatever).

0

精彩评论

暂无评论...
验证码 换一张
取 消