Announcement

Collapse
No announcement yet.

Animated Gif triggered with buttons

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Animated Gif triggered with buttons

    Just purchased a uOLED-128-G2 and was looking for an example for triggering an animated gif with buttons.

    So I would like to play one animated gif then when triggered by a button play another then go back to the original animation.

    I've looked at a couple of examples on the forum and have a gif playing but do have some glitches.

    Thanks

  • #2
    Guess I will have to work this out myself.

    Comment


    • #3
      Hi Andrew,

      Good Day.

      Apologies for the delay.

      Can you tell us the glitches that you encounter?
      Better if you can share your codes here so that we can check it.

      Thank you.

      Best Regards,
      Ferdinand

      Comment


      • #4
        Hi, It's on my other PC will upload later on.
        I have two items playing ,the first is a GIF with only 9 frames that glitches. The other has quite a few frames and plays Ok.

        Comment


        • #5
          Hi Ferdinand
          Ok heres what I have at the moment which is a cut and paste from various code on this forum.
          It's working as in playing the two videos but the short 10 frame gif has a glitch at the top of the screen on the last frame.

          Is there a way to abort the long video of 100 frames? when the switch changes state?

          Regards

          Andrew

          Code:
          #platform "GOLDELOX"
          
          // Program Skeleton 1.0 generated 08/04/2019 09:38:31
          
          #inherit "4DGL_16bitColours.fnc"
          
          #inherit "VisualConst.inc"
          
          #inherit "two vids and switched2Const.inc"
          func main()
          // Uncomment the following if uSD images, fonts or strings used.
          var frame :=0;
          //print("Starting\n") ;
          while(!media_Init())
          putstr("Drive not mounted...");
          pause(200);
          gfx_Cls();
          pause(200);
          wend
          pin_Set(INPUT, IO2);
          
          repeat
          media_SetSector(0,2); // Read the content
          flag := media_ReadByte(); // of sector 2
          if(pin_Read(IO2)==0)
          media_SetAdd(iVideo4H, iVideo4L) ; // point to the Video4 image
          media_Video(0, 1) ; // show video
          frame++;
          if (frame >= 100) frame:=0; // repeatedly
          else // if IO2 is low
          media_SetAdd(iVideo1H, iVideo1L) ; //
          media_VideoFrame(0,10,frame); // play video 1
          frame++;
          pause(10);
          if (frame >= 20) frame:=0; // repeatedly
          endif
          forever
          endfunc
          Last edited by AndrewB; 4 weeks ago.

          Comment


          • #6
            Hi Andrew,

            Good Day.

            Thank you for your update.

            I will try and check your code and get back to you.

            Regards,
            Ferdinand

            Comment


            • #7
              frsantiago just a message that I have sorted this out now.
              Have written from scratch and cut code down completely.
              Used the paste code option on your object Inspector.

              Glitches sorted on video also.

              Comment

              Working...
              X