2014년 12월 15일 월요일

How to manipulate Draw Text on canvas?


This might be dumb but I'm trying to take a piece of canvas text and make it fall from the sky.  (so it can be shot at?)

It seems easy with an image but I can't really figure it out with the canvas text thing?. 

Any ideas? 

BTW. If any of you guys that help out have a bitcoin address please put it in your signature. .  Thanks. 

--
You can't do it without a GREAT deal of overhead.  The text has to be drawn on the canvas.  Therefore, you'd have to draw the text on the canvas, then restore the canvas and drop down a pixel or two and redraw the text, then restore etc...

If the text is static, then make it a sprite and let it drop so you can shoot at it.

--
Yeah thats what I figured, problem is the text is dynamic from an API.. which makes it even more of a pain in the ass. :)... I might just go with another idea at this point

--
Here's an idea... Not sure if it would work but you could try...

Have a second canvas with a 0 alpha background... 
Paint the text to that, 
then save that canvas with the text.  
THEN, assign that saved picture to a sprite and rezize the sprite to fit the picture... 
then drop the sprite and you'll be able to act upon it...

--
Don't know if this will work, but here yah go... just my two cents :D  It looks pretty cool though :)


--

댓글 2개: