LoginSignup
12
12

More than 5 years have passed since last update.

SwiftでFacebook Popを使ったアニメーション

Last updated at Posted at 2015-01-09

インストール

1.CocoaPodsのPodfileに以下を追加

pod 'pop', '~> 1.0'

2.ターミナルで実行

pod install
  1. Briding-Headerに追加
#import <pop/POP.h>

使い方


//アニメーションの種類を選択 POPBasicAnimation  POPSpringAnimation POPDecayAnimation

let SpringAnimation = POPSpringAnimation()

//プロパティをセット
SpringAnimation.property = POPAnimatableProperty.propertyWithName(kPOPViewSize) as POPAnimatableProperty

//目標値
SpringAnimation.toValue = NSValue(CGSize:CGSizeMake(100, 100))

//バウンドさせる強さ?数
SpringAnimation.springBounciness=15;

//スピード
SpringAnimation.springSpeed=4;

//デリゲート
SpringAnimation.delegate=self

//アニメーションを適用したいviewに割り当て *forKeyに任意の名前
view.pop_addAnimation(SpringAnimation, forKey: "size")

デリゲートメソッド

func pop_animationDidStart(animation:POPAnimation){
   println("start")
}

func pop_animationDidStop(animation:POPAnimation){
   println("stop")
}

func pop_animationDidReachToValue(animation:POPAnimation){
   println("end")
}

プロパティの種類

プロパティの種類がなかなか調べても出てこなかったので書いておく。

View Properties

kPOPViewAlpha

kPOPViewBackgroundColor

kPOPViewBounds

kPOPViewCenter

kPOPViewFrame

kPOPViewScaleXY

kPOPViewSize

Layer Properties

kPOPLayerBackgroundColor

kPOPLayerBounds

kPOPLayerScaleXY

kPOPLayerSize

kPOPLayerOpacity

kPOPLayerPosition

kPOPLayerPositionX

kPOPLayerPositionY

kPOPLayerRotation

kPOPLayerBackgroundColor

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12