Skip to content

GIF Animation

Weiping Huang edited this page Apr 6, 2017 · 2 revisions

Similar to SVG Animation Wiki, WoWoGifView is another example of WoWoAnimationInterface. WoWoGifView implements the interface and changes the process of gif playing in the overridden methods.

WoWoGifView is modified from Cutta/GifView.

After the implementation modification, WoWoViewPager can control the process of playing the Gifs:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WoWoGifView gifView0 = (WoWoGifView) findViewById(R.id.gif_0);
    WoWoGifView gifView1 = (WoWoGifView) findViewById(R.id.gif_1);
    WoWoGifView gifView2 = (WoWoGifView) findViewById(R.id.gif_2);
    WoWoGifView gifView3 = (WoWoGifView) findViewById(R.id.gif_3);

    wowo.addAnimation(gifView0)
            .add(WoWoInterfaceAnimation.builder().page(0).implementedBy(gifView0).build());
    wowo.addAnimation(gifView1)
            .add(WoWoInterfaceAnimation.builder().page(1).implementedBy(gifView1).build());
    wowo.addAnimation(gifView2)
            .add(WoWoInterfaceAnimation.builder().page(2).implementedBy(gifView2).build());
    wowo.addAnimation(gifView3)
            .add(WoWoInterfaceAnimation.builder().page(3).implementedBy(gifView3).build());
    wowo.ready();
}

Check the GIF Demo Activity for more details.