This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set traverse string using canvas  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Bartender
Posts: 19221
85
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The text crawl effect is done by erasing the old text and writing it back into the canvas again only with a shifted "X" co-ordinate. You can do erasing in several different ways. One is by just resetting the rectangle that bounds the text to the canvas background color. Another is to rewrite the text in its original position, but using the canvas background color as the text color.

Then again, if the UI supports clipping (and I don't remember for the case of JME), you could simply set a clip rectangle to only repaint the area that holds the text and update the X co-ordinate in the paint method. Which is the preferred way to do things in systems that do painting in separate threads. For one thing, the clip/paint mechanism usually makes most effective use of the available graphics hardware and isn't impacted by other UI events.
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!