iOS動畫入門一

2021-07-03 16:00:03 字數 2055 閱讀 2078

在ios中動畫實現技術主要是:core animation。 core animation負責所有的滾動、旋轉、縮小和放大以及所有的ios動畫效果。其中uikit類通常都有animated:引數部分,它可以允許是否使用動畫。 

本文將介紹uiview動畫的實現方式,有基礎方法和block方法。

[uiview  beginanimations:nil context:nil];  //動畫開始

//code...

[uiview commitanimations]; //動畫結束

//eg 設定lb向下移動

[uiview beginanimations:nil context:nil];

[uiview setanimationduration:3];

cgpoint point = self.lb.center;

point.y += 100;

self.lb.center = point;

[uiview commitanimations];

[uiview animatewithduration:3   //動畫持續時間

animations:^];

//eg 改變lb的透明度

[uiview animatewithduration:3 animations:^];

uiview animatewithduration:3   //動畫持續時間

animations:^ completion:^(bool finished) ];

//eg 旋轉lb第一種方法:

cgaffinetransform endangel = cgaffinetransformmakerotation(90.0f*(m_pi/180.0f));

[uiview animatewithduration:3 animations:^ completion:^(bool finished) ];

[uiview animatewithduration:3   //動畫持續時間

delay:1 //動畫延遲時間

options:uiviewanimationoptioncurveeasein //設定動畫過渡效果

animations:^ completion:^(bool finished) ];

//eg 改變lb的字型大小 和位置

[uiview animatewithduration:3

delay:1

options:uiviewanimationoptioncurveeaseinout //設定動畫過渡效果

animations:^ completion:^(bool finished) ];

[uiview animatewithduration:3       //動畫持續時間

delay:1 //動畫延遲時間

usingspringwithdamping:1.0 //設定類似彈簧效果

initialspringvelocity:5.0 //設定初始速度

options:uiviewanimationoptioncurvelinear //設定動畫過渡效果

animations:^ completion:^(bool finished) ];

[uiview animatewithduration:3 delay:1 usingspringwithdamping:1.0 initialspringvelocity:5.0 options:uiviewanimationoptioncurveeaseinout animations:^ completion:^(bool finished) ];

iOS 過渡動畫之入門模仿系統

注意 我為過渡動畫寫了兩篇文章 第一篇 ios 過渡動畫之簡單模仿系統,主要分析系統簡單的動畫實現原理,以及講解座標系 絕對座標系 相對座標系,座標系轉換等知識,為第二篇儲備理論基礎。最後實現 mac 上的檔案預覽動畫。第二篇 ios 過渡動畫之高階模仿 airbnb 主要基於第一篇的理論來實現複雜...

iOS 動畫 UIView動畫

viewcontroller.m ui 23 動畫 import viewcontroller.h inte ce viewcontroller property strong,nonatomic iboutlet uiview opeview1 property strong,nonatomic ...

iOS 動畫筆記 一

你也肯定喜歡炫酷的動畫!一 從這裡 quartz2d 開始 在我的學習過程中,我是先從 quartz2d 開始學習的,它裡面的貝塞爾曲線在我們創造精美的動畫的過程中是必不可少的,quartz 2d 它首先就是乙個二維繪圖引擎,同時支援ios和mac系統。下面這裡一篇不錯的文章,仔細的講解了 quar...