UIKit-Animations

🚀 Awesome Animation Concepts

Slider 🎡: Personalized slider featuring images gracefully dispersing in various directions.

Gravity 🌌: Animated Xcode ascending a pedestal, triumphing over buildFailed challenges.

Thunder + Rain âš¡: Simulated rain and thunder effects.

DrawHearts 💖: Endearing depiction of a hand-drawn heart.

GradientButton 🌟: Smooth color transitions within the shape.

Exclusively crafted using UIKit; no additional frameworks needed. Enjoy the showcase! 🎉✨

Slider

Slider.mp4

View the code

Gravity

Gravity.mp4

    private var animator: UIDynamicAnimator?
    private var behavior: UICollisionBehavior?
  

Use UIDynamicAnimator and UICollisionBehavior for dynamic animations and collision handling.

View the code

TableView

TableView.mp4

Use CAEmitterCell and CAEmitterLayer to create animated particles.


    let emitterLayer = CAEmitterLayer()
    let cell = CAEmitterCell()
  

View the code

Thunder+Rain

thunderAndRain.mp4

The part of code:


    private var thunderstormLayer = CAEmitterLayer()
    private var rainCell = CAEmitterCell()
    private var lightningCell = CAEmitterCell()
    private var lightningLayer = CAEmitterLayer()
    // Configure rain emitter cell properties
    rainCell.birthRate = 150
    rainCell.lifetime = 6
    rainCell.velocity = 500
    rainCell.velocityRange = 50
    rainCell.emissionLongitude = .pi
    rainCell.emissionRange = .pi / 10
    rainCell.spin = 1.5
    rainCell.spinRange = 0.9
    rainCell.scale = 0.005
    rainCell.scaleRange = 0.05
    rainCell.contents = UIImage(named: Constant.particles)?.cgImage
  

View the code

DrawHearts

DrawHeart.mp4

Use UIBezierPath and CABasicAnimation to draw and animate it


  let path = UIBezierPath()
  let drawAnimation = CABasicAnimation(keyPath: "strokeEnd")
  

View the code

GradientButton

gradientButton.mp4

Use CAKeyframeAnimation and CABasicAnimation to animate shadow and changing color


    let colorAnimation = CAKeyframeAnimation(keyPath: "shadowColor")
    let gradientAnimation = CABasicAnimation(keyPath: "colors")
  

View the codes

Thank You for Watching!