播放按钮动画 XLPlayButton

码农软件 · 软件分类 · UI组件库 · 2019-08-01 20:12:39

软件介绍

爱奇艺、优酷播放按钮动画。

爱奇艺播放、暂停按钮动画效果

优酷播放、暂停按钮动画效果

实现原理

实现原理是利用贝塞尔曲线和CAShapeLayer绘制出三角、圆弧、直线,然后通过核心动画实现的动态效果。

使用方法

  • XLPlayButton 是继承UIButton的,只是创建方式和UIButton不同,其他的使用方法均一致。

  • 创建方法

_iQiYiPlayButton = [[iQiYiPlayButton alloc] initWithFrame:CGRectMake(0, 0, 60, 60) state:iQiYiPlayButtonStatePlay];
  • 唯一属性

/**
 通过setter方式控制按钮动画
 设置XLPlayButtonStatePlay显示播放按钮
 设置XLPlayButtonStatePause显示暂停按钮
 */
@property (nonatomic, assign) XLPlayButtonState buttonState
  • 切换状态方法

- (void)iQiYiPlayMethod {
    //通过判断当前状态 切换显示状态
    if (_iQiYiPlayButton.buttonState == iQiYiPlayButtonStatePause) {
        _iQiYiPlayButton.buttonState = iQiYiPlayButtonStatePlay;
    }else {
        _iQiYiPlayButton.buttonState = iQiYiPlayButtonStatePause;
    }
}

本文地址:https://www.codercto.com/soft/d/11437.html

Real-Time Rendering, Third Edition

Real-Time Rendering, Third Edition

Tomas Akenine-Moller、Eric Haines、Naty Hoffman / A K Peters/CRC Press / 2008-7-25 / USD 102.95

Thoroughly revised, this third edition focuses on modern techniques used to generate synthetic three-dimensional images in a fraction of a second. With the advent or programmable shaders, a wide varie......一起来看看 《Real-Time Rendering, Third Edition》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具