bitbrain / braingdx

:video_game: Game jam framework based on libgdx.
Apache License 2.0
84 stars 1 forks source link

Random Text Mutation 📑 #196

Closed bitbrain closed 5 years ago

bitbrain commented 5 years ago

Add possibility to mutate text:

String maskPool = "0123456789";
TextMutation mutation = new TextMutation("My Text", maskPool);
mutation.setFactor(0.8f);
mutation.update(1f);
String mutatedText = mutation.get();
mutation.setFactor(0.1f);
mutation.update(1f);
mutatedText = mutation.get();
// Also possible via tweening
Tween.to(mutation, TextMutationTween.FACTOR, 2f)
         .target(0f)
         .start(...);

For example, the following text "Hello World" and the following mask "123" with a factor of 0.5 would replace 50% of the characters (at random, except white spaces) "H1ll3 2or12"