Code Monkey home page Code Monkey logo

bounceballview's Introduction

bounceballview

android小球自由落体弹跳动画效果的自定义控件
源码解析博客地址:http://blog.csdn.net/ccy0122/article/details/77427795

效果图:


(因为gif图被压缩的原因动画看起来有点不流畅)

image
使用方法:

XML:

   <com.example.ccy.bounceballview.BounceBallView
        android:id="@+id/bbv1"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:background="#ffffff"
        app:anim_duration="3300"
        app:ball_count="15"
        app:ball_delay="220"
        app:bounce_count="3"/>


可用的属性:

  • bounce_count :小球弹跳次数
  • ball_color:小球颜色
  • ball_count:小球数量
  • ball_radius:小球半径
  • ball_delay:小球出现时间间隔(当小球数大于1时)
  • anim_duration:小球一次动画时长
  • physic_mode : 开启物理效果(下落加速上升减速)
  • random_color: 开启小球颜色随机
  • random_radius: 开启小球大小随机(在基础大小上下浮动)
  • random_path: 开启小球路径随机(在基础路径坐标上下浮动)

也可以在代码中进行配置:

bbv1 = (BounceBallView) findViewById(R.id.bbv1);
bbv.config()
     .ballCount(15)
     .bounceCount(3)
     .ballDelay(220)
     .duration(3300)
     .radius(15)
     .isPhysicMode(true)
     .isRamdomPath(true)
     .isRandomColor(true)
     .isRandomRadius(true)
     .apply();


最后开启动画:

 bbv1.start();

欢迎star,欢迎交流。


将该控件应用于加载框,还是很美观的:
image

bounceballview's People

Contributors

ccy0122 avatar

Watchers

James Cloos 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.