all right, answering my own question again.
i figured out how to achieve that effect, adjust the matrix and the
gradient parameter to adjust effect to your own liking.

        txtPaint = new Paint();
        txtPaint.setColor(Color.GRAY);
        txtPaint.setAntiAlias(true);
        txtPaint.setTextSize(25);
        shader = new LinearGradient(0, 0, 200, 0,
               new int[]{Color.argb(255, 120, 120, 120),
Color.argb(255, 120, 120, 120), Color.argb(255, 255, 255, 255)}, new
float[]{0, 0.7f, 1}, TileMode.MIRROR);
        txtPaint.setShader(shader);

    @Override
    protected void onDraw(Canvas canvas) {
        long now = System.currentTimeMillis();
        float elapsed = (now - lastTime)/7;
        dx+= elapsed;
        Matrix matrix = new Matrix();
        matrix.setTranslate(dx, 0);
        shader.setLocalMatrix(matrix);
        canvas.drawText("Text mask effect", 0, 25, txtPaint);
        lastTime = now;
        invalidate();
    }

On Nov 11, 11:39 am, zl25drexel <[EMAIL PROTECTED]> wrote:
> Do you have any example codes? Themaskgradient is not clipped over
> thetext.
>
> On Nov 11, 11:35 am, Romain Guy <[EMAIL PROTECTED]> wrote:
>
> > That's how to do it. What did you do exactly?
>
> > On Tue, Nov 11, 2008 at 8:33 AM, zl25drexel <[EMAIL PROTECTED]> wrote:
>
> > > Didnt work for me. Any other suggestions?
>
> > > On Nov 8, 3:09 pm, Romain Guy <[EMAIL PROTECTED]> wrote:
> > >> Hi,
>
> > >> You would need to draw thetextmanually on a Canvas object (from the
> > >> onDraw() method of your View for instance.) Then, in the Paint you use
> > >> to draw thetext, simply set a linear gradient shader. All you have to
> > >> do is animate the coordinates of the shader to make it look like it's
> > >> moving and you'll get the desired effect.
>
> > >> On Sat, Nov 8, 2008 at 12:03 PM, zl25drexel <[EMAIL PROTECTED]> wrote:
>
> > >> > Hi, does anyone know how to dotextmaskeffect in android?
>
> > >> > like the below in flash
> > >> >http://www.entheosweb.com/Flash/video_tutorials/shining_text_effect.asp
>
> > >> > thanks,
>
> > >> --
> > >> Romain Guywww.curious-creature.org
>
> > --
> > Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to