Git Product home page Git Product logo

progress's Introduction

avatar

考虑到环形进度条的需求很多,所以通过canvas实现了一个简易的环形进度条的组件

组件一共提供了6个属性,分别是

width 环形进度条的宽度,单位是rpx,环形进度条宽度和高度是一样的,这里只用设置width就行了

borderColor 环形进度条的边框颜色

borderWidth 环形进度条的边框宽度,单位是rpx

angle 环形进度条的旋转角度,单位是deg

duration 过渡时间,如果大于0,环形进度条将根据时间进行平滑绘制

startAngle 起点角度,默认为0,就是钟表12点的位置

angle 环形进度条的旋转角度

这个旋转角度的意思是终点角度相对于起点角度的值

如果startAngle为0,angle 为90,相当于绘制从0到90这一段的角度,

如果startAngle为90,angle为90,相当于绘制从90到180这一段的角度,

这样做的好处是可以直接通过angle的值判断绘制方向

angle如果大于0,就进行顺时针绘制

angle如果小于0,就进行逆时针绘制

代码片段:https://developers.weixin.qq.com/s/oEd12Kmx7hnB

微信社区文档 https://developers.weixin.qq.com/community/develop/article/doc/0002226b0f4fa8da16ab563d756413

progress's People

Contributors

newzhaozilong avatar

Watchers

James Cloos avatar  avatar

Forkers

fenildf

progress's Issues

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.