GithubHelp home page GithubHelp logo

candlesanimview's Introduction

CandlesAnimView


  动画设计想法来自于Gal Shir的GIF设计,右边的蜡烛吹灭左边的蜡烛,并不断循环作为Loading,加入了停止动画的接口,但是暂时没有想好结束动画应该用什么形式展示更自然,目前动画结束为停止蜡烛。

DEMO


结构


API


  暂时只写了结束动画的接口,但也加入了一些蜡烛动作的回调,如果有需要可以自行拓展其他方面的效果。

    //监听动画结束
    private StopAnimListener mStopAnimListener;

    public interface StopAnimListener{
        //结束动画调用后启动的方法。
        public void OnAnimStop();
    }

    public void setStopAnimListener(StopAnimListener l){
        this.mStopAnimListener = l;
    }
    /*
     调用Loading结束动画。
     */
    public void stopAnim(){
        mAnimControler.stopAnimation();
        if(mStopAnimListener != null){
            mStopAnimListener.OnAnimStop();
        }
    }
        mCandlesAnimView.setStopAnimListener(new CandlesAnimView.StopAnimListener() {
            @Override
            public void OnAnimStop() {
                Toast.makeText(MainActivity.this,"End Anim.",Toast.LENGTH_SHORT).show();
            }
        });

调用方式


  1. 配置XML
    <com.yellow5a5.candlesanimlib.CandlesAnimView
        android:id="@+id/candles_view"
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
  1. Java代码创建
        CandlesAnimView mCandlesAnimView = new CandlesAnimView(MainActivity.this);
        //...addView..

其它


  目前动画结束为停止吹熄蜡烛。适配上通过View本身的宽高的比例进行设置并不理想,可自行修改固定mHeight和mWidth的内部逻辑完善。

candlesanimview's People

Contributors

yellow5a5 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.