Skip to content
프로젝트

소개

Swift animation made easy

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Logo

Fluent License MIT

Badge w/ Version Badge w/ Platform

Swift Animations made Easy

Installation

  • Add the following to your Podfile and run pod install
    pod 'Fluent', '~> 0.1'
  • or add the following to your Cartfile and run carthage update
    github "matthewcheok/Fluent"
  • or clone as a git submodule,

  • or just copy files in the Fluent folder into your project.

Using Fluent

Fluent makes writing animations declarative and chainable.

boxView
.animate(0.5)
.rotate(0.5)
.scale(2)
.backgroundColor(.blueColor())
.waitThenAnimate(0.5)
.scale(1)
.backgroundColor(.redColor())

Simply call one of the animation methods, of which only duration is required:

  • animate(duration: NSTimeInterval, velocity: CGFloat , damping: CGFloat, options: UIViewAnimationOptions)
  • waitThenAnimate(duration: NSTimeInterval, velocity: CGFloat , damping: CGFloat, options: UIViewAnimationOptions)

All common properties on UIView are supported:

  • scale(factor: CGFloat)
  • translate(x: CGFloat, y: CGFloat)
  • rotate(cycles: CGFloat)
  • backgroundColor(color: UIColor)
  • alpha(alpha: CGFloat)
  • frame(frame: CGRect)
  • bounds(bounds: CGRect)
  • center(center: CGPoint)

There are also relative versions of the transforms:

  • scaleBy(factor: CGFloat)
  • translateBy(x: CGFloat, y: CGFloat)
  • rotateBy(cycles: CGFloat)

You may not mix absolute and relative transformations in the same animation.

Using transforms

The order of the transformations are important!

To reverse the following:

boxView
.animate(1)
.translateBy(50, 50)
.rotateBy(0.5)
.scaleBy(2)
.backgroundColor(.blueColor())
.alpha(0.7)

We need to undo the transformations in reverse or get weird results:

boxView
.animate(1)
.scaleBy(0.5)
.rotateBy(-0.5)
.translateBy(-50, -50)
.backgroundColor(.redColor())

License

Fluent is under the MIT license.

관련 프로젝트 살펴보기

불러오는 중…