Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:39:09+00:00 2026-06-11T09:39:09+00:00

I can’t get to achieve a smooth very slow text animation in a Canvas

  • 0

I can’t get to achieve a smooth very slow text animation in a Canvas because Canvas.drawText doesn’t want to draw “between pixels”. For example, given 4 consecutive frames where I draw a text with an Y offset of 0, 0.5, 1, 1.5, the canvas will actually draw it at offsets 0, 0, 1, 1, respectively, which causes the animation to be “jerky”. There’s a flag called Paint.SUBPIXEL_TEXT_FLAG that’s supposed to keep the float precision.

I found a related thread in which Romain Guy said that this flag is currently not supported in Android: Meaning of some Paint constants in Android.

My question is: is there any existing workaround ?

Note: Drawing the text in another bitmap once, then draw this bitmap with float offsets instead of drawing the text doesn’t seem to work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:39:11+00:00Added an answer on June 11, 2026 at 9:39 am

    You could simulate this effect by drawing two texts side-by-side with alpha balancing (between 127 and 255) between the two elements.

    Let’s assume your text is moving from up to bottom, and the current vertical position is 10.28. You just have to draw one text at position 10 with an alpha near of 127 and the other text at position 11 with an alpha near of 255.

    Here is a little (ugly :D) example :

    private void doDraw(Canvas canvas) {
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setColor(Color.BLACK);
        paint.setTextSize(20);
        canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
    
        mY += 0.05f;
        paint.setColor(Color.RED);
    
        if (Math.floor(mY) == mY) {
            canvas.drawText("test", mX, mY, paint);
        } else {
            float mY1 = (float) Math.floor(mY);
            float mY2 = mY1 + 1;
            float delta = mY - mY1;
    
            paint.setAlpha((int) ((1 - delta) * 127) + 127);
            canvas.drawText("test", mX, mY1, paint);
    
            paint.setAlpha((int) ((delta) * 127) + 127);
            canvas.drawText("test", mX, mY2, paint);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
Can MOSS integrate and get user profiles from multiple Active Directory and/or LDAP stores?
Can anyone tell me what i am doing wrong? I am trying to get
Can anyone tell me why this doesn't work? <?php $lang = $_get[lang]; if (($lang
Can find why i get this error can someone help? package Android.data; public class
Can anyone help me trying to find out why this doesn't work. The brushes
Can't get over it, no matter how much I search. I have AlarmManager, where
can I get the value of a variable declared in a procedure then use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.