title: How to draw a text using CoreGrahpics & Core animation
body: <p>I want to achieve this type of animation.please check this URL</p>
  
  <p><a href="https://www.dropbox.com/s/gz9vfy5refsh7a5/Screen.mov?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/gz9vfy5refsh7a5/Screen.mov?dl=0</a></p>
  
  <p>I am adding Code which I have used in the project where I have used Core Graphics to render the text with animation but I am not able to animate text which is being shown in the mentioned link</p>
  
  <p><strong>This is code which i am using to render the text on the screen</strong></p>
  
  <pre><code>    let context = UIGraphicsGetCurrentContext()!
      context.saveGState()
      context.setAlpha(noLightText)
  
      let nOLIGHTRect = CGRect(x: 145.66, y: 590, width: 449.38, height: 125)
      let nOLIGHTStyle = NSMutableParagraphStyle()
      nOLIGHTStyle.alignment = .center
      let nOLIGHTFontAttributes = [
          .font: UIFont(name: "Futura-CondensedExtraBold", size: 96)!,
          .foregroundColor: nOLIGHTColor,
          .paragraphStyle: nOLIGHTStyle,
          ] as [NSAttributedStringKey: Any]
  
      "NO LIGHT".draw(in: nOLIGHTRect, withAttributes: nOLIGHTFontAttributes)
  
      context.restoreGState()
  
  
      //// LOW LIGHT Drawing
      context.saveGState()
      context.setAlpha(_0)
  
      let lOWLIGHTRect = CGRect(x: 145.94, y: 590, width: 449.38, height: 125)
      let lOWLIGHTStyle = NSMutableParagraphStyle()
      lOWLIGHTStyle.alignment = .left
      let lOWLIGHTFontAttributes = [
          .font: UIFont(name: "Futura-CondensedExtraBold", size: 96)!,
          .foregroundColor: lOWLIGHTColor,
          .paragraphStyle: lOWLIGHTStyle,
          ] as [NSAttributedStringKey: Any]
  
      "LOW LIGHT".draw(in: lOWLIGHTRect, withAttributes: lOWLIGHTFontAttributes)
  
      context.restoreGState()
  
  
      //// MID LIGHT Drawing
      context.saveGState()
      context.setAlpha(mediumLightText)
  
      let mIDLIGHTRect = CGRect(x: 145.77, y: 590, width: 449.38, height: 125)
      let mIDLIGHTStyle = NSMutableParagraphStyle()
      mIDLIGHTStyle.alignment = .left
      let mIDLIGHTFontAttributes = [
          .font: UIFont(name: "Futura-CondensedExtraBold", size: 96)!,
          .foregroundColor: mIDLIGHTColor,
          .paragraphStyle: mIDLIGHTStyle,
          ] as [NSAttributedStringKey: Any]
  
  
      "MID LIGHT".draw(in: mIDLIGHTRect, withAttributes: mIDLIGHTFontAttributes)
  
      context.restoreGState()
  </code></pre>