Giter Site home page Giter Site logo

yunzixun / ccanimationbtn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xiaosao6/ccanimationbtn

0.0 1.0 0.0 1.92 MB

A simple subclass of UIButton imitates the animation effect of favor button in DouYin App. 一个UIButton子类,模仿抖音App中点赞按钮的动画效果。

Objective-C 100.00%

ccanimationbtn's Introduction

CCAnimationBtn

A simple subclass of UIButton imitates the animation effect of favor button in DouYin App.

一个UIButton子类,模仿抖音App中点赞按钮的动画效果


CCAnimationBtn


效果:

image

示例:

CCAnimationBtn *btn = [[CCAnimationBtn alloc] initWithFrame:CGRectMake(60, 60, 150, 150)];
    [btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
-(void)btnClicked:(UIButton *)btn{
    btn.selected = !btn.selected;
}

特性

  • 可配置项: 线条数量、线条末端宽度、线条长度相对比例、中心图片相对比例、动画总时长、线条颜色等。
  • 使用代码绘制心形,无需添加图片

原理说明

绘制心形,使用UIBezierPath绘制二次曲线与弧线;

绘制放射线,使用CAShapeLayer结合mask绘制多个三角形图层;

动画主要使用CABasicAnimation进行缩放,位移,旋转,透明度等属性进行动画

使用方法

直接下载工程,拷贝CCAnimationBtn.h与.m文件,(调整参数)即可使用

注意事项

  • 含有CASpringAnimation,需要iOS 9.0+

License

none

ccanimationbtn's People

Contributors

xiaosao6 avatar

Watchers

Jornathan Thorne 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.