B4A Library dgTextEffects - simple text effects

Hi all,

today wandering around the Android Developer site I met component TextSwitcher that made me think about a quick and easy way to set a few text effects to enrich any basic (very basic) app.
So, here it is dgTextEffects!
It can be used both from the Designer or from code.

Basically it consists of a TextSwitcher able to quicly alternate between its two labels (which are inner elements) and a few preset effects to choose from.
Using published methods it should be easy to set more effects.

Keep in mind this was a very quick job (less than two hours from first reading about the TextSwitcher to this post), so everything is undoubtedly a bit inaccurate.
Anyway it's usable enough to have some fun.

Please find attached both the library and a demo app.

Enjoy.
 

Attachments

  • dgTextEffects_014.zip
    6.7 KB · Views: 501
  • TEDemo_014.zip
    10.1 KB · Views: 546
Last edited:

udg

Expert
Licensed User
Longtime User
Thanks to the excellent Martin Pearman's tool, here it is my library's current version documentation:

Library name: dgTextEffects
Author: UDG
Version: 0.14
  • clTextEffects
    Methods:
    • initialize (TargetModule As Object, EventName As String) As String
      Initializes the object.
      Make sure that the Customview in designer is large enough to display the labels with the format you need.
      Required for both Designer and Manual setup
      TargetModule - calling module
      EventName - prefix name for events associated to this class (none at the moment)
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • designercreateview (Base As PanelWrapper, Lbl As LabelWrapper, Props As Map) As String
      Used by the designer when added there. Do not use manually. Use Initialize and Setup!
    • setup (Base As PanelWrapper) As String
      TextEffect setup - TE will take all panel Base space and be positione at 0,0 relative to Base
      Base - panel container for TextEffect
    • setup2 (Base As PanelWrapper, posX As Int, posY As Int, aWidth As Int, aHeight As Int) As String
      TextEffect alternate setup - TE will be positioned and dimensioned as specified
      Base - panel container for TextEffect
      posX, posY - coordinates to position TE relative to its container
      awidth, aHeight - TE dimensions
    • setautostart (auto As Boolean) As String
      set if animation should automatically start on calling an effect
    • setcolor (BkgColor As Int) As String
      Set the TextEffects background color
    • setinnertext (aText1 As String, aText2 As String) As String
      Set text for inner labels. First transition effect will go from aLabel1 to aLabel2
    • setinnertextcolors (T1color As Int, B1Color As Int, T2color As Int, B2Color As Int) As String
      Set Text and Background color to use for first (T1xxx) and second (T2xxx) label.
      Default values: Text = black and Backgroung = transparent for both labels
    • setinnertextproperties (FirstLabel As Boolean, aTextSize As Int, aTypeface As TypefaceWrapper, aGravity As Int) As String
      Set the Text related properties in a single shot
      FirstLabel = True : applies prop to first internal label; False: applies props to second internal label
    • setinterval (ms As Long) As String
      set animation interval in milliseconds
    • setvisible (Visible As Boolean) As String
      Set the visibility of the TextEffects object
    • starteffect (start As Boolean) As String
      manually start/stop an animation; start = True starts the selected animation
    • textalternate (txt1 As String, txt2 As String) As String
      Alternate between txt1 and txt2
    • textflashb (Txt As String, Color1 As Int, Color2 As Int) As String
      Flash text alternating two backgroud colors
    • textflasht (Txt As String, Color1 As Int, Color2 As Int) As String
      Flash text alternating two text colors
    • textgrow (Txt As String, Size1 As Int, Size2 As Int) As String
      Alternate Txt between size1 and size2
    • textrotate (txt As String) As String
      Circular rotation of text ( e.g. abc->bca->cab->abc )
    • textrotate2 (txt As String, maxSize As Int) As String
      Circular rotation of text limited to a substring maxSize in width
      Set maxSize to container's width in order to see as much text as possible
    Properties:
    • autostart As Void
      set if animation should automatically start on calling an effect
    • color As Void
      Set the TextEffects background color
    • interval As Void
      set animation interval in milliseconds
    • visible As Void
      Set the visibility of the TextEffects object
 

ibra939

Active Member
Licensed User
Longtime User
thanks
 
  • Like
Reactions: udg

LucaMs

Expert
Licensed User
Longtime User
1593277614816.png
 
Top