日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

POPSpring动画参数详解

發布時間:2025/3/21 javascript 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 POPSpring动画参数详解 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

POPSpring動畫參數詳解

?

效果

?

源碼

https://github.com/YouXianMing/Animations

// // POPSpringParameterController.m // Animations // // Created by YouXianMing on 15/11/29. // Copyright ? 2015年 YouXianMing. All rights reserved. // #import "POPSpringParameterController.h" #import "RangeValueView.h" #import "UIView+SetRect.h" #import "POP.h" #import "FontAttribute.h" #import "ForegroundColorAttribute.h" #import "NSMutableAttributedString+StringAttribute.h"#define Width [UIScreen mainScreen].bounds.size.width #define Height [UIScreen mainScreen].bounds.size.height@interface POPSpringParameterController ()@property (nonatomic, strong) UILabel *secondsLabel; @property (nonatomic, strong) NSDate *dateStart;@property (nonatomic, strong) RangeValueView *rangeSpeed; @property (nonatomic, strong) RangeValueView *rangeBounciness; @property (nonatomic, strong) RangeValueView *rangeMass; @property (nonatomic, strong) RangeValueView *rangeFriction; @property (nonatomic, strong) RangeValueView *rangeTension;@property (nonatomic, strong) UIButton *showView;@end@implementation POPSpringParameterController- (void)viewDidLoad {[super viewDidLoad]; }- (void)setup {[super setup];[self initSecondLabel];[self initButton];[self initRangeViews];[self bringTitleViewToFront]; }- (void)initSecondLabel {self.secondsLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10 + 64, 100, 20)];self.secondsLabel.attributedText = [self stringWithFloat:0.f];[self.view addSubview:self.secondsLabel]; }- (NSAttributedString *)stringWithFloat:(CGFloat)value {// 字符串NSString *stringValue = [NSString stringWithFormat:@"%.2f", value];NSString *secondString = [NSString stringWithFormat:@"seconds"];NSString *totalString = [NSString stringWithFormat:@"%@ %@", stringValue, secondString];// 字體UIFont *allFont = Font_Avenir(12);UIFont *numFont = Font_Avenir_Light(20);FontAttribute *totalFont = [FontAttribute new];totalFont.font = allFont;totalFont.effectRange = NSMakeRange(0, totalString.length);FontAttribute *valueFont = [FontAttribute new];valueFont.font = numFont;valueFont.effectRange = [totalString rangeOfString:stringValue];ForegroundColorAttribute *textColor = [ForegroundColorAttribute new];textColor.color = [UIColor grayColor];textColor.effectRange = NSMakeRange(0, totalString.length);ForegroundColorAttribute *numColor = [ForegroundColorAttribute new];numColor.color = [UIColor blackColor];numColor.effectRange = [totalString rangeOfString:stringValue];NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:totalString];[attributeString addStringAttribute:totalFont];[attributeString addStringAttribute:valueFont];[attributeString addStringAttribute:textColor];[attributeString addStringAttribute:numColor];return attributeString; }- (void)initButton {CGFloat gap = Height - 60 - 40*4 - 64;CGFloat width = 100.f;self.showView = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, width, width)];self.showView.center = CGPointMake(self.view.middleX, 64 + gap / 2.f);self.showView.backgroundColor = [UIColor cyanColor];self.showView.layer.cornerRadius = self.showView.width / 2.f;[self.view addSubview:self.showView];[self.showView addTarget:selfaction:@selector(doAnimation)forControlEvents:UIControlEventTouchUpInside]; }- (void)doAnimation {// 移除動畫 [self.showView.layer pop_removeAllAnimations];POPSpringAnimation *spring = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];// 設置代理spring.delegate = self;// 動畫起始值 + 動畫結束值spring.fromValue = [NSValue valueWithCGSize:CGSizeMake(1.f, 1.f)];spring.toValue = [NSValue valueWithCGSize:CGSizeMake(2.f, 2.f)];// 參數的設置spring.springSpeed = self.rangeSpeed.currentValue;spring.springBounciness = self.rangeBounciness.currentValue;spring.dynamicsMass = self.rangeMass.currentValue;spring.dynamicsFriction = self.rangeFriction.currentValue;spring.dynamicsTension = self.rangeTension.currentValue;// 執行動畫 [self.showView.layer pop_addAnimation:spring forKey:nil]; }- (void)pop_animationDidStart:(POPAnimation *)anim {self.dateStart = [NSDate date]; }- (void)pop_animationDidApply:(POPAnimation *)anim {CGFloat seconds = -[self.dateStart timeIntervalSinceNow];self.secondsLabel.attributedText = [self stringWithFloat:seconds]; }- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished {CGFloat seconds = -[self.dateStart timeIntervalSinceNow];self.secondsLabel.attributedText = [self stringWithFloat:seconds]; }- (void)initRangeViews {self.rangeSpeed = [RangeValueView rangeValueViewWithFrame:CGRectMake(10, Height - 60, Width - 20, 0)name:@"速度 Speed"minValue:0.fmaxValue:20.fdefaultValue:12.f];[self.view addSubview:self.rangeSpeed];self.rangeBounciness = [RangeValueView rangeValueViewWithFrame:CGRectMake(10, Height - 60 - 40, Width - 20, 0)name:@"彈力 Bounciness"minValue:0.fmaxValue:20.fdefaultValue:4.f];[self.view addSubview:self.rangeBounciness];self.rangeMass = [RangeValueView rangeValueViewWithFrame:CGRectMake(10, Height - 60 - 40*2, Width - 20, 0)name:@"質量 Mass"minValue:0.1maxValue:10.fdefaultValue:1.f];[self.view addSubview:self.rangeMass];self.rangeFriction = [RangeValueView rangeValueViewWithFrame:CGRectMake(10, Height - 60 - 40*3, Width - 20, 0)name:@"摩擦 Friction"minValue:1maxValue:50defaultValue:30.486980];[self.view addSubview:self.rangeFriction];self.rangeTension = [RangeValueView rangeValueViewWithFrame:CGRectMake(10, Height - 60 - 40*4, Width - 20, 0)name:@"拉力 Tension"minValue:1maxValue:1000defaultValue:300];[self.view addSubview:self.rangeTension]; }@end

?

細節

?

總結

以上是生活随笔為你收集整理的POPSpring动画参数详解的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 丰满人妻熟妇乱偷人无码 | 色婷婷激情av | 牲欲强的熟妇农村老妇女视频 | 天堂亚洲精品 | 久久久久亚洲av无码专区喷水 | 久久久亚洲精品视频 | 熟妇人妻中文字幕无码老熟妇 | 成人91在线观看 | 亚洲国产精品久久久久久6q | 泰坦尼克号3小时49分的观看方法 | 国产精品理论片 | 欧美日韩电影一区二区三区 | 国产美女精品一区二区三区 | 国产一区二区三区在线视频观看 | 澳门黄色录像 | 久久精品国产亚洲av久 | 九九热视频在线 | 欧美色图11p | 少妇脚交调教玩男人的视频 | 欧美日韩 一区二区三区 | 久久国产精品-国产精品 | 97视频在线看 | 欧美韩国日本在线 | 桃谷绘里香在线观看 | 亚洲经典自拍 | 秋霞毛片少妇激情免费 | 中国黄色免费 | 开心激情站 | 噜噜噜噜私人影院 | 中文字幕日韩有码 | 中文字幕一区二区三区四区免费看 | 超碰91在线观看 | 免费人妻一区二区三区 | 好吊色视频在线观看 | 97caocao| 影音先锋制服丝袜 | 一本一道久久a久久精品蜜桃 | 美女张开腿让男人操 | 香蕉网在线 | 肉丝美脚视频一区二区 | 国产最新网址 | 中文字幕av影院 | 亚洲一区中文 | aaa成人| a在线看| 日韩精品免费一区二区在线观看 | 国产欧美日本在线 | 国产一区亚洲一区 | 国产精品久久久久久亚洲 | 日韩中文字幕综合 | 久久一区二区视频 | 九色自拍视频 | 在线免费看污网站 | 激情五月激情综合网 | 精品一区二区三区蜜臀 | 日本毛片视频 | 潘金莲激情呻吟欲求不满视频 | 天天干天天插天天操 | av制服丝袜 | 国产亚洲精品美女久久久久 | 一级黄色片免费 | 亚洲精品一区二区三区影院忠贞 | 国产福利一区二区视频 | wwwxxoo | 香蕉a | 超碰一区二区三区 | 日韩少妇一区二区 | 黄色aaaaa | 国产香蕉9| 偷啪自啪| 国产三级视频网站 | 黄色一级免费视频 | 国产一区二区三区91 | 在线视频污| 欧美综合图片 | 天堂va蜜桃一区二区三区漫画版 | 欧美一区二区三区免费在线观看 | 怡红院成人影院 | 国产97在线观看 | www.久久久久.com | 黄色一级片在线看 | 天天射日日操 | 加勒比波多野结衣 | 国产强伦人妻毛片 | 人禽高h交 | 风间由美在线视频 | 中文字幕超碰在线 | 蜜桃视频在线网站 | 色一情一乱一伦一区二区三区 | 999久久久精品 | 日韩激情毛片 | 午夜视频www| h片在线观看免费 | 红猫大本营在线观看的 | 精品美女视频 | 一区二区三区久久精品 | 给我免费观看片在线电影的 | www.四虎在线 | 亚洲xx在线 |