iOS 動(dòng)畫(huà) 波紋 水波 聲波 海水

YSCAnimation

Github地址 : https://github.com/xiaochaofeiyu/YSCAnimation
對(duì)你有幫助的話幫我點(diǎn)顆星星哦!

ripple animation

1). singlelineripple --> corresponding class YSCRippleView

[_rippleView showWithRippleType:YSCRippleTypeLine]

2). ringRipple --> corresponding class YSCRippleView

[_rippleView showWithRippleType:YSCRippleTypeRing]

3). cicleRipple --> corresponding class YSCRippleView

[_rippleView showWithRippleType:YSCRippleTypeCircle]

4). mixedripple --> corresponding class YSCRippleView

[_rippleView showWithRippleType:YSCRippleTypeMixed]

wave animation

1). pusle --> corresponding class YSCWaveView

[_waveView showWaveViewWithType:YSCWaveTypePulse]

2). wave --> corresponding class YSCWaveView

[_waveView showWaveViewWithType:YSCWaveTypeVoice]

3). movedWave --> corresponding class YSCWaveView

[_waveView showWaveViewWithType:YSCWaveTypeMovedVoice]

mask animation

1). circleLoad --> corresponding class YSCCircleLoadAnimationView

YSCCircleLoadAnimationView *shapeView = [[YSCCircleLoadAnimationView alloc] initWithFrame:self.view.bounds];
UIImage *image = [UIImage imageNamed:@"tree.jpg"];
shapeView.loadingImage.image = image;
[self.view addSubview:shapeView];
[shapeView startLoading];

2). microphone wave --> corresponding class YSCMicrophoneWaveView

YSCMicrophoneWaveView *microphoneWaveView = [[YSCMicrophoneWaveView alloc] init];
[microphoneWaveView showMicrophoneWaveInParentView:self.view withFrame:self.view.bounds];

3). fanshaped wave --> corresponding class YSCFanShapedView

- (YSCFanShapedView *)fanshapedView
{
    if (!_fanshapedView) {
        self.fanshapedView = [[YSCFanShapedView alloc] init];
        _fanshapedView.frame = CGRectMake(0, 0, 300, 150);
        _fanshapedView.center = CGPointMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0 - 100);        
    }
    
    return _fanshapedView;
}

//show
[self.fanshapedView showInParentView:self.view WithType:YSCFanShapedShowTypeExpand];

voice wave

1). voice wave --> corresponding class YSCVoiceWaveView YSCVoiceLoadingCircleView

//show
self.voiceWaveView = [[YSCVoiceWaveView alloc] init];
[self.voiceWaveView showInParentView:self.voiceWaveParentView];
[self.voiceWaveView startVoiceWave];

//hide
[self.voiceWaveView stopVoiceWaveWithShowLoadingViewCallback:^{
            [self.updateVolumeTimer invalidate];
            _updateVolumeTimer = nil;
            [self.loadingView startLoadingInParentView:self.view];
        }];

water wave

1). water wave --> corresponding class YSCWaterWaveView

- (YSCWaterWaveView *)waterWave
{
    if (!_waterWave) {
        self.waterWave = [[YSCWaterWaveView alloc] init];
        _waterWave.frame = CGRectMake(0, 0, self.view.bounds.size.width, 300);
        _waterWave.percent = 0.6;
        _waterWave.firstWaveColor = [UIColor colorWithRed:146/255.0 green:148/255.0 blue:216/255.0 alpha:1.0];
        _waterWave.secondWaveColor = [UIColor colorWithRed:84/255.0 green:87/255.0 blue:197/255.0 alpha:1.0];
    }
    
    return _waterWave;
}

//show
[self.view addSubview:self.waterWave];
[self.waterWave startWave];

seawater wave

1). seawater wave --> corresponding class YSCSeaGLView
tip: it should not run in simulator

self.seaGLView = [[YSCSeaGLView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
[self.view addSubview:_seaGLView];

//hide
- (void)viewDidDisappear:(BOOL)animated
{
    [_seaGLView removeFromParent];
    _seaGLView = nil;
}

emitter animation

1). fire --> corresponding class YSCFireViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor=[UIColor whiteColor];
    //設(shè)置發(fā)射器
    _fireEmitter=[[CAEmitterLayer alloc] init];
    _fireEmitter.emitterPosition=CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height-20);
    _fireEmitter.emitterSize=CGSizeMake(self.view.frame.size.width-100, 20);
    _fireEmitter.renderMode = kCAEmitterLayerAdditive;
    //發(fā)射單元
    //火焰
    CAEmitterCell *fire = [CAEmitterCell emitterCell];
    fire.birthRate=800;
    fire.lifetime=2.0;
    fire.lifetimeRange=1.5;
    fire.color=[[UIColor colorWithRed:0.8 green:0.4 blue:0.2 alpha:0.1] CGColor];
    fire.contents=(id)[[UIImage imageNamed:@"fire"] CGImage];
    [fire setName:@"fire"];
    
    fire.velocity=160;
    fire.velocityRange=80;
    fire.emissionLongitude=M_PI+M_PI_2;
    fire.emissionRange=M_PI_2;
    
    fire.scaleSpeed=0.3;
    fire.spin=0.2;
    fire.alphaSpeed = -0.05;
    
    //煙霧
    CAEmitterCell *smoke = [CAEmitterCell emitterCell];
    smoke.birthRate=400;
    smoke.lifetime=3.0;
    smoke.lifetimeRange=1.5;
    smoke.color=[[UIColor colorWithRed:1 green:1 blue:1 alpha:0.05] CGColor];
    smoke.contents=(id)[[UIImage imageNamed:@"fire"] CGImage];
    [smoke setName:@"smoke"];
    
    smoke.velocity=250;
    smoke.velocityRange=100;
    smoke.emissionLongitude=M_PI+M_PI_2;
    smoke.emissionRange=M_PI_2;
    smoke.alphaSpeed = -0.05;
    
    _fireEmitter.emitterCells=[NSArray arrayWithObjects:smoke, fire,nil];
    [self.view.layer addSublayer:_fireEmitter];
    
}

2). butterfly --> corresponding class YSCButterflyViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor=[UIColor whiteColor];
    //emitter
    _butterflyEmitter=[[CAEmitterLayer alloc] init];
    _butterflyEmitter.emitterPosition=CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height-20);
    _butterflyEmitter.emitterSize=CGSizeMake(self.view.frame.size.width-100, 20);
    _butterflyEmitter.renderMode = kCAEmitterLayerUnordered;
    _butterflyEmitter.emitterShape = kCAEmitterLayerCuboid;
    
    _butterflyEmitter.emitterDepth = 10;
    _butterflyEmitter.preservesDepth = YES;
    
    //cells
    //blue butterfly
    CAEmitterCell *blueButterfly = [CAEmitterCell emitterCell];
    blueButterfly.birthRate=8;
    blueButterfly.lifetime=5.0;
    blueButterfly.lifetimeRange=1.5;
    blueButterfly.color=[[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.1] CGColor];
    blueButterfly.contents=(id)[[UIImage imageNamed:@"butterfly1"] CGImage];
    [blueButterfly setName:@"blueButterfly"];
    
    blueButterfly.velocity=160;
    blueButterfly.velocityRange=80;
    blueButterfly.emissionLongitude=M_PI+M_PI_2;
    blueButterfly.emissionLatitude = M_PI+M_PI_2;
    blueButterfly.emissionRange=M_PI_2;
    
    blueButterfly.scaleSpeed=0.3;
    blueButterfly.spin=0.2;
    blueButterfly.alphaSpeed = 0.2;
    
    //yellow butterfly
    CAEmitterCell *yellowButterfly = [CAEmitterCell emitterCell];
    yellowButterfly.birthRate=4;
    yellowButterfly.lifetime=5.0;
    yellowButterfly.lifetimeRange=1.5;
    yellowButterfly.color=[[UIColor colorWithRed:1 green:1 blue:1 alpha:0.05] CGColor];
    yellowButterfly.contents=(id)[[UIImage imageNamed:@"butterfly2"] CGImage];
    [yellowButterfly setName:@"yellowButterfly"];
    
    yellowButterfly.velocity=250;
    yellowButterfly.velocityRange=100;
    yellowButterfly.emissionLongitude=M_PI+M_PI_2;
    yellowButterfly.emissionLatitude = M_PI+M_PI_2;
    yellowButterfly.emissionRange=M_PI_2;
    yellowButterfly.alphaSpeed = 0.2;
    yellowButterfly.scaleSpeed=0.3;
    yellowButterfly.spin=0.2;
    _butterflyEmitter.emitterCells=[NSArray arrayWithObjects:yellowButterfly, blueButterfly,nil];
    [self.view.layer addSublayer:_butterflyEmitter];
    
}

repicator animation

1). matrixCircle --> corresponding class YSCMatrixCircleAnimationView

self.matrixCircleView = [[YSCMatrixCircleAnimationView alloc] initWithFrame:CGRectMake(0, 0, 300, 300) xNum:8 yNum:8];
    _matrixCircleView.center = CGPointMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0);
    
[self.view addSubview:_matrixCircleView];

2). circle ripple --> corresponding class YSCCircleRippleView

self.rippleView = [[YSCCircleRippleView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
_rippleView.center = CGPointMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0);
[self.view addSubview:_rippleView];
_rippleView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.4];
[_rippleView startAnimation];

Demo下載地址 :https://github.com/xiaochaofeiyu/YSCAnimation

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末尿赚,一起剝皮案震驚了整個(gè)濱河市散庶,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌凌净,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,682評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件须教,死亡現(xiàn)場(chǎng)離奇詭異轻腺,居然都是意外死亡贬养,警方通過(guò)查閱死者的電腦和手機(jī)迁筛,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,277評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)尉桩,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)贪庙,“玉大人止邮,你說(shuō)我怎么就攤上這事∏” “怎么了鹰晨?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,083評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵模蜡,是天一觀的道長(zhǎng)扁凛。 經(jīng)常有香客問(wèn)我,道長(zhǎng)卤妒,這世上最難降的妖魔是什么荚孵? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,763評(píng)論 1 295
  • 正文 為了忘掉前任收叶,我火速辦了婚禮判没,結(jié)果婚禮上隅茎,老公的妹妹穿的比我還像新娘。我一直安慰自己俏竞,他們只是感情好魂毁,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,785評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布席楚。 她就那樣靜靜地躺著,像睡著了一般垮斯。 火紅的嫁衣襯著肌膚如雪兜蠕。 梳的紋絲不亂的頭發(fā)上抛寝,一...
    開(kāi)封第一講書(shū)人閱讀 51,624評(píng)論 1 305
  • 那天墩剖,我揣著相機(jī)與錄音,去河邊找鬼郊霎。 笑死书劝,一個(gè)胖子當(dāng)著我的面吹牛土至,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播骡苞,決...
    沈念sama閱讀 40,358評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼解幽,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼躲株!你這毒婦竟也來(lái)了镣衡?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,261評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤辖所,失蹤者是張志新(化名)和其女友劉穎曾雕,沒(méi)想到半個(gè)月后助被,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體揩环,經(jīng)...
    沈念sama閱讀 45,722評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡丰滑,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評(píng)論 3 336
  • 正文 我和宋清朗相戀三年褒墨,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片浑玛。...
    茶點(diǎn)故事閱讀 40,030評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡顾彰,死狀恐怖涨享,靈堂內(nèi)的尸體忽然破棺而出仆百,到底是詐尸還是另有隱情,我是刑警寧澤栏账,帶...
    沈念sama閱讀 35,737評(píng)論 5 346
  • 正文 年R本政府宣布挡爵,位于F島的核電站甚垦,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏闭翩。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,360評(píng)論 3 330
  • 文/蒙蒙 一兑障、第九天 我趴在偏房一處隱蔽的房頂上張望流译。 院中可真熱鬧者疤,春花似錦、人聲如沸革砸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,941評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)仗岸。三九已至,卻和暖如春较锡,著一層夾襖步出監(jiān)牢的瞬間盗痒,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,057評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工骡楼, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留鸟整,地道東北人朦蕴。 一個(gè)月前我還...
    沈念sama閱讀 48,237評(píng)論 3 371
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像涉茧,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子伴栓,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,976評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • YSCAnimation Github地址 :https://github.com/xiaochaofeiyu/Y...
    90后的思維閱讀 2,372評(píng)論 0 2
  • afinalAfinal是一個(gè)android的ioc惑淳,orm框架 https://github.com/yangf...
    passiontim閱讀 15,434評(píng)論 2 45
  • 他們說(shuō)他是中國(guó)近現(xiàn)代歷史上最具影響力的人物之一汛聚,是學(xué)者短荐、教授叹哭,是思想家、文學(xué)家糠排、史學(xué)家、哲學(xué)家入宦、詩(shī)人室琢,是新文化運(yùn)動(dòng)...
    AMy119閱讀 809評(píng)論 5 13
  • 當(dāng)拖著重重的行李慢慢走在這個(gè)我曾經(jīng)百般數(shù)落萬(wàn)般嫌棄的地方時(shí)涯肩,我不自覺(jué)的難過(guò),心里五味雜陳病苗。我坐在行李箱上看著灰蒙蒙...
    茶木森閱讀 391評(píng)論 0 0
  • 我是一個(gè)不折不扣的手機(jī)控硫朦,所有的空閑時(shí)間都被微博背镇、微信花履、QQ挚赊、朋友圈、言情小說(shuō)占據(jù)妹卿,進(jìn)取心被一點(diǎn)一點(diǎn)吞噬干凈蔑鹦,每天...
    半夏與卿閱讀 1,921評(píng)論 0 3