Problem with partial upd .. function, please help.

Hello.

I'm sorry to start another thread for OnPartialUpdate.

I know there is a lot on the forum, but I have not found a solution and an example that would solve my problem.

I will try to describe here what I need to call regularly via this function.

I have five slashes that I created in the font maker.

These slashes appear to me instead of seconds, ie 1 slash = first second.

It is like
"Knight Rider Car" reads slashes from left to right in seconds. Wink

The problem is that when I do dc.setClip at the bottom of the screen for slash size, width, height, I get to total time fast.


I would ask someone who could help me with this feature.

The best example of how to proceed.


Here's what I'm trying to do in OnPartialUpdate.

I do dcClearClip in OnUpdate...

Thank you

function onPartialUpdate(dc){
		sleepMode = true;

		
		
		dc.setClip(20, 175, 25, 20);
        dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT);
        dc.drawText(20, 175, $.fontIcon_seconds, $.ICON_SECONDS, Gfx.TEXT_JUSTIFY_CENTER);
    	 
 
    	
        }
         }

  • do you draw only one slash in during one onPartialUpdate()?

  • first I tried to make the whole area for slashes, I got a total time of 58 000.

    Then I tried to draw only one slash and I also got a total time of 50 000.

    It's a font, not dc.fillPolygon.

    I would need help with this feature to do it properly.

    Thank you

  • make test and see if you exceed time
    slash has dimension 25x20

    function onPartialUpdate(dc)
    {
            dc.setClip(20, 175, 26, 20);
            dc.setColor(
                SYS.getClockTime().sec % 2 ? Graphics.COLOR_BLUE : Graphics.COLOR_RED, 
                Graphics.COLOR_TRANSPARENT);
            dc.drawText(33, 175, $.fontIcon_seconds, $.ICON_SECONDS, Gfx.TEXT_JUSTIFY_CENTER);  
    }

  • not like that would be okay and i only got 5,000 total time.

    now they need to move by the seconds as in the attached video.

    the actual size of the slash is 26x30

    Thank you

  • yes and do not put anything more in onPartial that need calulation something very fast

    you have to define memebers in view const/var it can be multidimensionaln array  if you find continuous algorithm depend on seconds or dictionary where key is second e.g.

     const  seconds_x =

    [

    [20, 33],

    [45, 58]

    ...

    ]

    and you have to move clip and draw

    function onPartialUpdate(dc)
    {

           var s  = SYS.getClockTime().sec % something;
            dc.setClip(seconds_x [s,0], 175, 26, 20);
            dc.setColor(
                SYS.getClockTime().sec % 2 ? Graphics.COLOR_BLUE : Graphics.COLOR_RED, 
                Graphics.COLOR_TRANSPARENT);
            dc.drawText(seconds_x [s,1], 175, $.fontIcon_seconds, $.ICON_SECONDS, Gfx.TEXT_JUSTIFY_CENTER);  
    }

  • and if resign from drawing from drawing left /right  but always e.g. left it should be rather simple

  • thanks, but if I enter your code, I get a lot of errors, can you please fix it?

    something change, not found.

  • it was the example  (pseudo code) you have to find algorithm that change seconds%something  to  row of array

    it's your work Slight smile if you want so nice splash, now you know only you have to draw only one char in each onPariatl call

    of course you have to use a lot of IF's instead but each IF costs

  • thank you very much for your help. can I still ask what the if function should look like?

    I'm not at a good level in coding yet, I'm still learning

  • yes, but you have to attach code - resolving problems is difficult without it

    and I'm not all the time online

    At the beginning, I recommend resignation from drawing left/right? only one way:

    /////

    /////

    /////

    /////