Giter Site home page Giter Site logo

emosheeep / batterycharge Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 1.76 MB

使用CSS和JS实现安卓手机两种常见的充电特效,多次打磨。

Home Page: http://projects.biubiubius.com/BatteryCharge/index.html

HTML 19.27% JavaScript 26.54% CSS 54.18%
css3 es6-class velocityjs less jquery-animate

batterycharge's Introduction

BatteryCharge

使用CSS和JS实现安卓手机两种常见的充电特效,多次打磨,有需要的小伙伴可以看看。

基于CSS3,暂未考虑浏览器兼容问题

点击这里预览

CSS使用Less编译(或许你会因此爱上写CSS)。两块电池的实现效果原理文章中有讲到,我主要说说关于第二块圆形电池的想法。

圆形电池里面的小圆点是通过JS动态创建并插入,并使用Math.random()计算随机位置和半径大小。 其实我有想过作者的想法,使用纯CSS可以事先画好一定数量的圆点,按照一定的先后顺序错开运动,也可以实现。 我只是单纯想练习一下自己的动画能力。通过Circle类描述圆点的属性,通过Run类控制圆点的创建,插入,删除,运动等。

这里,顺便推荐一个好用的,不依赖jQuery的动画库Velocity.js 我比较喜欢他的一个特点,每一个动画都会返回一个Promise对象,在某些情况下涉及异步流程控制的时候,确实很好用

参考

【掘金】CSS动画?教你使用障眼法,打造炫酷充电效果

文章全部使用CSS实现,但个人加入的自己的想法,部分功能采用JS实现。

GIF

GIF

batterycharge's People

Contributors

emosheeep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

clockget jaccosu

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.