音乐震动条

音乐震动条(new:复制层)

  • 自定义redLayer

  • 通过代码自动布局

    • 父控件的高度 - 本身的高度
  • 把layer添加到contentView.layer上面

  • 添加动画

    • 基础缩放动画CABaisicAnimation
      • keyPath
      • toValue
      • repeatCount
      • autoreverses
      • duration
    • addAnimation
  • 修改锚点

    • (0,1)
  • position

    • x:0
    • y:contentView.bounds.size.height
  • 只做y轴方向的缩放

  • 复制层

    • CAReplicatorLayer
    • 设置大小尺寸
    • frame = self.contentView.bounds
    • addSublayer:
    • 能够复制它里面的子层
    • instanceCount 要复制的份数,包含自己
    • 对复制出来的子层,做形变操作
    • instanceTransorm
    • instanceelay:动画延迟时间

你可能感兴趣的:(音乐震动条)