×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    159

    how to change form background color in slow motion using timer

    hello, i am working on nokia sdk1.1 with lwuit 1.5.i am changing form background color using timer after every one second .My problem is that it change frequently but i want to that it changes in slow motion so please suggest me how can i do it

    Code:
    Display.init(this);
    		 form=new Form();
    		
    		 
    		//form.getStyle().setBgColor(157621);
    		Timer aTimer = new Timer();
            TimerTask ttask = new TimerTask() {
                public void run() {
                    System.out.println("time active.......................");
                    RGBcode();
                    int rgb1 = 65536 * r1 + 256 * g1 + b1;
           		 System.out.println("value of r g b is...77777777777777777777............"+r1+"  "+g1+"   "+b1);
           		 System.out.println("value of interger ..77777777777777777777......"+rgb1);
           		form.getStyle().setBgColor(rgb1);
           		form.repaint();
                  aTimer.schedule(ttask, 0, 1000);
    		form.show();
    In RGBcode() method i am change the R G B color and creating integer code which is use as a form color .So please help me how can i change bgcolor in slowly
    Thanks.

  2. #2
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: how to change form background color in slow motion using timer

    USe Thread.sleep(duration) to make the thread sleep for a particular amount of time.Change the colour again after the sleep duration.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,768

    Re: how to change form background color in slow motion using timer

    I do not see where you change r1, g1 or b1, but that change could provide smoothness.
    Like initialize a couple values as
    Code:
    int r1=0;
    int deltar1=1;
    and in the timer put
    Code:
    r1+=deltar1;
    if(r1>=255){r1=255;deltar1=-1;}
    if(r1<=0){r1=0;deltar1=1;}
    ...
    this way r1 will "bounce" between 0 and 255, back and forth.

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    159

    Re: how to change form background color in slow motion using timer

    Thanks for reply,but i think you did'nt get my point i am sending two url
    A.http://videobam.com/gJHrN
    B.http://videobam.com/UGyZB
    i am to say that i want to get A part video output but i am getting B part out put .so please suggest me how we can do like A video output .

    In A part video color chages in slow motion but in B it chagesg frequen
    so i want to get output as A part video.

  5. #5
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: how to change form background color in slow motion using timer

    Hi

    The smoothness in transition between colours also depends on how many colours the device can display.The android phone you showed supports around 16 million colours, while Asha 310 supports only 65K colours.Hence even if you use the same logic in both the devices, the output may vary

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,768

    Re: how to change form background color in slow motion using timer

    After checking the videos I think it is not the smoothness, there are simply jumps to a totally different colour. When dealing with multiple transitions, you have to make sure that transition B starts from the very same colour where transition A finished. Fading from red to purple, then suddenly from blue to green can not be smooth, regardless of the display technology used.

Similar Threads

  1. Help: how to set the background color for a Form, List !!!
    By cvraiden in forum Mobile Java General
    Replies: 5
    Last Post: 2009-12-22, 11:02
  2. change background color of Form in LWUIT
    By jackofall in forum Mobile Java General
    Replies: 1
    Last Post: 2009-05-19, 05:26
  3. How to change the form label color
    By ash_21 in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-02-20, 13:30
  4. form background color
    By Alezzz in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-08-09, 01:23
  5. how to change color of a form and List
    By atiqe in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2007-06-08, 12:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×