How To Start An Animated Bitmap

About usage, announcement and development of skins for VLC
Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

How To Start An Animated Bitmap

Postby Grumpus Maximus » 28 Aug 2014 22:37

I am afraid I must restart this topic because everything I have read in previous threads does not help me to understand why I cannot get this to work.

I have created a window called Main. Inside, there are two layouts (Layout1 and Layout2). I have placed a button in Layout1 that switches to Layout2 when clicked:

--> CODE:

<Button up="Layout2_Open" action="Main.setLayout(Layout2)" id="Button_Layout2" x="258" y="79"/>


I have placed an animated bitmap in Layout2 which I want to play when the layout is active, but it does not play. I understand that switching the layout of a window (for example, Layout1 to Layout2) is supposed to start the animation (but changing from one window to another does not). My code looks like this:

-->CODE

<Bitmap id="Layout2_Open_Sequence" file="Resources/Background_Layout2.png" alphacolor=#FF00FF>

<SubBitmap id="Layout2_Animation_Open" x="1" y="1" height="1580" width="536" nbframes="10" fps="10" loop="1"/>

</Bitmap>

<Window id="Main" visible="true">

<Layout id="Layout1" width="538" height="387">

<Button up="Set_Layout_2" action="Main.setLayout(Layout2)" id="Go_To_Layout2" x="258" y="79"/>

</Layout>

<Layout id="Layout2" width="538" height="387">

<Image id="OpenPanel" image="Layout2_Animation_Open" visible="true" action="none"/>

<Button up="Set_Layout_1" action="Main.setLayout(Layout1)" id="Go_To_Layout1" x="258" y="79"/>

</Layout>

</Window>

I use a button to change the active layout back to Layout1 so that the bitmap "resets" so it can be replayed the next time I want to go to Layout2 (Layout2 is to be for VLC settings and such, and it's purpose is to only be active when I need to change something, thus leaving the main layout ...Layout1... clean and without the clutter of buttons).

My question is why does the animation not work? Am I missing something in the code? As I said, everything I have read in the forums makes me believe that this should work. Please help!


Thank you,
Grumps

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How To Start An Animated Bitmap

Postby erwan10 » 29 Aug 2014 14:36

Please, set verbosity to 2 and check the logs. Chances are that you have warnings such as :

[091494e0] skins2 interface warning: drawBitmap: source rect too small, ignoring
[091494e0] skins2 interface warning: sub-bitmap Layout2_Animation_Open ignored
[091494e0] skins2 interface warning: drawBitmap: source rect too small, ignoring

My guess is that you decided to offset the sub-bitmap by 1 in both directions (x="1" y="1") but forgot to decrease the height and width by 1. In other words, you have to ensure a subbitmap can fully stand within a bitmap. Probably just remove x="1" y="1" and that should work ?

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 29 Aug 2014 15:15

erwan10: Thank you for responding. I have no errors in the log. I re-checked bitmap and sub-bitmap. Bitmap was 1581h x 538w, and sub-bitmap was 1580h x 536w. I resized the main bitmap to 1580h x 536w to match sub-bitmap and set xy coordinates to 0,0 as you suggested. Unfortunately, this does not correct the problem. The first frame of the sub-bitmap is displayed when I switch to Layout2 but does not animate. I can switch back to Layout1 with no problems, and VLC plays media as usual.

Code now looks like this:

<Bitmap id="Layout2_Open_Sequence" file="Resources/Background_Layout2.png" alphacolor=#FF00FF> -->This Bitmap is 1580H x 536W

<SubBitmap id="Layout2_Animation_Open" x="0" y="0" height="1580" width="536" nbframes="10" fps="10" loop="1"/>

</Bitmap>

<Window id="Main" visible="true">

<Layout id="Layout1" width="538" height="387">

<Button up="Set_Layout_2" action="Main.setLayout(Layout2)" id="Go_To_Layout2" x="258" y="79"/>

</Layout>

<Layout id="Layout2" width="538" height="387">

<Image id="OpenPanel" image="Layout2_Animation_Open" visible="true" action="none"/>

<Button up="Set_Layout_1" action="Main.setLayout(Layout1)" id="Go_To_Layout1" x="258" y="79"/>

</Layout>

</Window>

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 29 Aug 2014 15:36

Please let me add this information:

OS: Windows 7 Professional (32-bit)
VLC version 2.1.3 Rincewind
VLC Editor version 0.8.6.dev
XML Editor: Microsoft Visual Studio 2005
PNG Editor: Paint.net v3.5.11

I hope this might help.

-Grumps

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 29 Aug 2014 20:40

I was able to work around using the <Button up/> parameter: <Button up="Layout2_Animation_Open" id="OpenPanel"/>. But I still think the original issue needs to be looked into.

Thank you for your help.

Kind regards,
Grumps

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How To Start An Animated Bitmap

Postby erwan10 » 29 Aug 2014 23:45

Actually, I had not realized you were using an Image tag. Animated images do work only with Button or Checkbox tags. It is not implemented with the Image tag as weird as it may seem ! This is how it was designed long ago, and it should not be a problem since a button with no action is actually equivalent to an image. But, I agree the documentation should really be updated to clarify this point.

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 02 Sep 2014 14:11

Erwan10: Thank you again for your insight. Now, I have another question: I have noticed that when the animated bitmap is activated, it flashes the last frame of the bitmap. This is but a small nuisance but distracting. Is there a way to work around this? I could change the last frame to an empty one but then the last image that I want is not there. I have tried to put a second animated bitmap over the first to see if the transition is less noticeable but it does not work (either it's last frame flashes as well or the animation "does not appear" to play-I know it probably is but the images I have tried make it look static). I know this is not a very big deal but for me, with the skin I am making, it is a little irritating, but it is OK overall. Is there a way to have the delay parameter put back in just to keep the second bitmap from painting so quickly. I think this might help if I could delay the bitmap for just 500 milliseconds or so. Thanks for all your help!

Kindest regards,
Grumps

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How To Start An Animated Bitmap

Postby erwan10 » 02 Sep 2014 15:04

It may be a bug. If so, please fill in a bug report (https://trac.videolan.org/vlc) and attach a .vlt file as a test case to demonstrate this flash issue. I will then have a look at it and fix it if needed.

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 03 Sep 2014 18:44

erwan10:

The ticket number is 12083. Thanks for looking into it.

Kind regards,
Grumps

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How To Start An Animated Bitmap

Postby erwan10 » 04 Sep 2014 14:46

Thanks for reporting these issues. The test case proved very useful !

A new nightly build (http://nightlies.videolan.org/build/) should be available as soon as tomorrow. Please, use the vlc3.0.0 branch. Any additional tests are very welcomed to ensure everything got fixed properly. The test case was tested successfully on Linux with the latest build. If ok, then backport to previous version would be requested.

Grumpus Maximus
Blank Cone
Blank Cone
Posts: 13
Joined: 20 Mar 2014 17:02

Re: How To Start An Animated Bitmap

Postby Grumpus Maximus » 08 Sep 2014 13:43

erwan10:

These builds seemed to have worked! No more flashing and no more replaying on hover over. Thank you so much for all of your help. Hopefully I will be able to upload some skins I've been working on soon. When you say "...backport to previous version should be requested.", are you saying I need to go back to trac and request there by new ticket?

Kindest regards,
Grumps

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How To Start An Animated Bitmap

Postby erwan10 » 08 Sep 2014 16:28

The backport to vlc-2-2 actually already occurred :-).

So it is fixed for both vlc-3.0 (the dev version, no release date) and vlc-2.2 (the next release that should be rolled out soon). Both versions can be dowloaded as nightly builds for testing purpose.

androidbabbles1
New Cone
New Cone
Posts: 1
Joined: 17 Dec 2014 13:10

Re: How To Start An Animated Bitmap

Postby androidbabbles1 » 20 Dec 2014 10:45

Nice idea!Also You can add animation to your imageview like this:

TranslateAnimation anim = new TranslateAnimation( 0, xDest - originalPos[0] , 0, yDest - originalPos[1] );
anim.setDuration(1000);
anim.setFillAfter( true );
view.startAnimation(anim);


Return to “Skins”

Who is online

Users browsing this forum: No registered users and 76 guests