Code Monkey home page Code Monkey logo

iosanimation's Introduction

IOS Animation

How we can draw shape?

Swift has classes that help us complete our purpose.

UIBezierPath: This class has some shapes paths like rectangles or ovals. Also you can define your custom path in order to create custom shapes.

CAShapeLayer: The shape which will be drawed must be of this type. You can configure its shape by giving it the path.

CABasicAnimation & CAAnimationGroup: With this class you can define your animation for your shapes.

Custom shape:

UIBezierPath class let you create any shape using different methods:

·move: in order to define the init point or a new init point.
·addLine: join two points
.addCurve: Use Bezier curves which have 4 points to define it(init point, end point, firt control point and second control point). [Bezier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) 

Resource: UIBezierPath by Apple

CAShapeLayer: let you setting custom path of the shape. And different characteristics, like color or shadows.

·.path: Set form of shape
·.strokeStart: 
·.strokeEnd: 
·.fillColor
·.strokeColor
·.lineWidth
·.shadowColor
·.shadowRadius
·.strokeStart and strokeEnd: [By Apple: "The value in this property indicates the relative point along the path at which to begin stroking while the strokeEnd property defines the end point. A value of 0.0 represents the beginning of the path while a value of 1.0 represents the end of the path."](https://developer.apple.com/documentation/quartzcore/cashapelayer/1521929-strokestart)

For more information: apple

CABasicAnimation & CAShapeLayer: You can add a simple basic animation(CABasicAnimation) or you can join different animations(CAShapeLayer).

·.fromValue: Defines the value the receiver uses to start interpolation.
·.toValue: Defines the value the receiver uses to end interpolation.
·.duration: seconds it takes for the animation to finish. 
·.autoreverse: complete the path and reverse.
·.repeatCount: .infinity or a number of times you want to repeat the animation.

Installation:

  1. Clone the repositorie.
  2. Open the project with XCode and Run.

iosanimation's People

Watchers

James Cloos avatar Javier Galera Garrido 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.