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 7817451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:13:43+00:00 2026-06-02T06:13:43+00:00

in live wallpaper we have method called onOffsetsChanged which is called when user swipes

  • 0

in live wallpaper we have method called onOffsetsChanged which is called when user swipes on the screen of this phone the value of xOffset is changed from 0.1 to 0.9

now i want to make is this way that when the value falls less then 0.5

it might return different value

for example

0.5 –> 0.48

0.4 –> 0.46

0.3 –> 0.44

0.2 –> 0.42

0.1 –> 0.40

but when it increases from 0.5 it stays the same

0.9 –> 0.9

0.8 –> 0.8

0.7 –> 0.7

0.6 –> 0.6

can some one help me with this formula i am not able to get any logic here

@Override
public void onOffsetsChanged(final float xOffset, final float yOffset, final float xOffsetStep, final float yOffsetStep, final int xPixelOffset, final int yPixelOffset) 
{
    super.onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep, xPixelOffset, yPixelOffset);
    Runnable offsetsChangedCommand = new Runnable() 
    {
        public void run() {
            if (xOffsetStep != 0f) 
            {
                glRenderer.setParallax(xOffset - 0.5f);
            }
        };
    };
    executor.execute(offsetsChangedCommand);
}
  • 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-02T06:13:45+00:00Added an answer on June 2, 2026 at 6:13 am

    There may be a better way, but the easiest thing I can think of is to do:

    float actualOffset;
    if(xOffset>0.5f)
    {
        actualOffset=xOffset;
    }
    else
    {
        actualOffset=0.38f+(xOffset*0.2f);
    }
    
    glRenderer.setParallax(actualOffset- 0.5f);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom image preference in my Live Wallpaper that allows a user
I have a live wallpaper that uses vibrate permission. When the slide screen that
I have a Live Wallpaper that uses various screen touches to trigger certain events.
I have created Live Wallpaper app. When I start this via Wallpapers -> Live
Helo everyone! I have this live wallpaper in witch I try to show a
When rendering my live wallpaper I have some banding gradient artifacts. This article perfectly
I have to draw a circle in live wallpaper when it touches the boundary
So I am modifying the Cube live wallpaper example. I have a class that
I'm extracting Android Grass live wallpaper code from the Android source. I have put
I am writing a live wallpaper which utilizes a number of paths. I scale

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.