GithubHelp home page GithubHelp logo

fengliushaoyezhanghaohao / nhgiftanimationexample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nenhall/nhgiftanimationexample

0.0 2.0 0.0 12.56 MB

直播类送礼动画<豪华礼物+小礼物>

Objective-C 100.00%

nhgiftanimationexample's Introduction

NHGiftAnimationExample

直播类送礼动画<豪华礼物+小礼物>:
代码会持续更新,现直播的app里内有太多的动画,由于时间关系不能一次共享所有动画聘为,这次先共享几个比较火爆的动画,支持真机和模拟器上运行,最低支持iOS8.0,具体的代码属性,代码中都有注释.
Aaron Swartz


使用方法:
/**
* 加载动画视图
*
* @param frame 动画视图的大小
*
* @return 返回你需要的动画视图
*/
+ (nullable instancetype)loadCarViewWithPoint:(CGPoint)point;

/**

  • 设置动画的运行轨迹
  • 注:调此方法前,如需要设置多于两个控制点的动画,请先设置好curve_control_point_*及curve_end_point_*位置 其它属性也是一样,在调此方法前设置好
  • @param movePoints 开始的位置(出发点)
  • @param endPoint 最终动画所在停留的位置
    */
  • (void)addAnimationsMoveToPoint:(CGPoint)movePoints endPoint:(CGPoint)endPoint;

实例一个送车动画:

NHCarView *car = [NHCarView loadCarViewWithPoint:CGPointZero];

//方法如下:数组内的每个元素代码一个控制点和结束点
NSMutableArray *pointArrs = [[NSMutableArray alloc] init];
CGFloat width = [UIScreen mainScreen].bounds.size.width / 2;
[pointArrs addObject:NSStringFromCGRect(CGRectMake(width, 300, width, 300))];
car.curveControlAndEndPoints = pointArrs;

[car addAnimationsMoveToPoint:CGPointMake(0, 100) endPoint:CGPointMake(self.view.bounds.size.width +166, 500)]; [self.view addSubview:car];

若你想换动画图片,直接去resource.bundle文件夹里面找到相应图片,把你的新图片替换上,
但你的图片名记得换成我原有图片名;
图片的尺寸需要和原图片的尺寸一样,如果不一样,则影响动画的效果。
//
//
// NegHao
// // Created by NegHao on 16/5/14.
// Copyright © 2016年 NegHao.W All rights reserved.
// 有疑问之处可以联系本博主:NegHao,有不足之处,或者错误的地方欢迎指正,谢谢!
// github:https://github.com/NegHao/NHGiftAnimationExample

nhgiftanimationexample's People

Contributors

iosdeveloper-s avatar

Watchers

James Cloos avatar Mr Zhang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.