1.旋轉動畫
cabasicanimation* rotationanimation;
rotationanimation = [cabasicanimation animationwithkeypath:@"transform.rotation.z"];
rotationanimation.tovalue = [nsnumber numberwithfloat: m_pi * 2.0 ];
[camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout];
rotationanimation.duration = 2;
rotationanimation.repeatcount = 1000;//你可以設定到最大的整數值
rotationanimation.cumulative = no;
rotationanimation.removedoncompletion = no;
rotationanimation.fillmode = kcafillmodeforwards;
[self.image.layer addanimation:rotationanimation forkey:@"rotation"];
2.縮放動畫
cabasicanimation *scaleanimation = [cabasicanimation animationwithkeypath:@"transform.scale"];
scaleanimation.fromvalue = [nsnumber numberwithfloat:0.0];
scaleanimation.tovalue = [nsnumber numberwithfloat:1.0];
scaleanimation.duration = 1.0f;
scaleanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout];
scaleanimation.removedoncompletion = no;
scaleanimation.fillmode = kcafillmodeforwards;
[self.image.layer addanimation:scaleanimation forkey:@"scale"];
3.透明度變化
cabasicanimation *opacityanimation = [cabasicanimation animationwithkeypath:@"opacity"];
opacityanimation.fromvalue = [nsnumber numberwithfloat:1];
opacityanimation.tovalue = [nsnumber numberwithfloat:0];
opacityanimation.duration = 2.0f;
opacityanimation.removedoncompletion = no;
opacityanimation.fillmode = kcafillmodeforwards;
[self.image.layer addanimation:opacityanimation forkey:@"opacity"];
4.建立動畫組,把動畫放在乙個組裡展示
caanimationgroup *animationgroup = [caanimationgroup animation];
animationgroup.duration = 2.0f;
animationgroup.autoreverses = yes; //是否重播,原動畫的倒播
animationgroup.repeatcount = nsnotfound;//huge_valf; //huge_valf,源自math.h
[animationgroup setanimations:[nsarray arraywithobjects:rotationanimation, scaleanimation, opacityanimation,nil]];
extjs的一些簡單動畫1
ext.element 類也定義了部分動畫函式。我們先來看看ext.fx 類中的重要方法。1 slidein string anchor object options 功能 滑入效果 值 說明 tl 左上角 t 頂部 tr 右上角 l 左邊 r 右邊 bl 左下角 b 底部 br 右下角 ext.o...
自己動手編寫一些簡單的轉場動畫
有時候在專案開發的時候可能會有製作一些特殊的轉場動畫的需求,比如實現像開門一樣的動畫,檢視從中間裂開,然後分別從兩邊飛出。首先有個很實用的函式來擷取當前螢幕的,這裡的引數第乙個一般填寫self.view,第二個引數可以根據實際需要來寫frame uiimage captureview uiview ...
iOS 對RunTime的一些簡單了解
好多天沒有寫部落格,就把這些天總結的一些東西拿出來分享下 下面簡單的談一談runtime,小弟才疏學淺,有錯誤的地方希望指出來。不多說了直接上 吧,好多筆記都寫成了注釋。runtime 簡稱為執行時。oc就是一種執行時機制,就是再執行的時候執行的一種機制,其中最主要的是訊息機制 相對來說c語言是在編...