GithubHelp home page GithubHelp logo

ruanfeixiong / shopcaranimation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jinht/shopcaranimation

0.0 2.0 0.0 866 KB

购物车类的抛物线动画(支持上抛或者下抛) && 阻尼动画(弹球动画)

License: MIT License

Ruby 2.35% Objective-C 97.65%

shopcaranimation's Introduction

JhtShopCarAnimation

Contents

购物车抛物线动画

阻尼动画

needed to pay attention.

1. podfile

platform:ios, '8.0'

target '*****' do

pod 'JhtAnimationTools'
        
end

2.这是一个轻量级的动画文件,可以实现购物车的上抛 && 下抛动画;此外我还写了一个简单的阻尼动画,供大家交流使用


3.使用起来比较方便,只需导入 JhtAnimationTools.h 头文件即可

(1) 购物车动画

/**
  * rect: 动画开始的坐标; 如果rect传CGRectZero,则用默认开始坐标;
  * imageView: 动画对应的imageView;
  * view : 在哪个view上显示 (一般传self.view);
  * lastPoint: 动画结束的坐标点;
  * controlPoint: 动画过程中抛物线的中间转折点;
  * per: 决定控制点,起点和终点X坐标之间距离 1/per; 注:如果per <= 0, 则控制点由controlPoint决定,否则控制点由per决定;
  * expandAnimationTime: 动画变大的时间
  * narrowAnimationTime: 动画变小的时间
  * animationValue: 动画变大过程中,变为原来的几倍大
  * 注意 : 如果动画过程中,你不想让图片变大变小,保持原来的大小运动,传值如下:
           expandAnimationTime:0.0f
           narrowAnimationTime : 动画总共的时间;
           animationValue:1.0f
*/
 - (void)aniStartShopCarAnimationWithStartRect:(CGRect)rect withImageView:(UIImageView *)imageView withView:(UIView *)view withEndPoint:(CGPoint)lastPoint withControlPoint:(CGPoint)controlPoint withStartToEndSpacePercentage:(NSInteger)per withExpandAnimationTime:(CFTimeInterval)expandAnimationTime withNarrowAnimationTime:(CFTimeInterval)narrowAnimationTime withAnimationValue:(CGFloat)animationValue;

(2) 阻尼动画

  • 创建阻尼动画的View
/** 获得的阻尼动画的View
  * view:黑色背景View的父view(例如:self.view);
  * frame:是这个阻尼View的坐标
  * isBlack:yes 需要出现黑色背景, no不需要
  * bgColor:背景颜色
 */
 - (UIView *)aniDampingAnimationWithFView:(UIView *)view withFrame:(CGRect)frame withBackgroundColor:(UIColor *)bgColor isNeedBlackView:(BOOL)isBlack;
  • 阻尼动画相关使用方法
/** 开始动画阻尼动画 */
- (void)aniStartDampingAnimation;
/** 关闭阻尼动画 */
- (void)aniCloseDampingAnimation;
/** 获得阻尼动画的黑色背景 */
- (UIView *)aniGetDampingBlackView;

(3) 动画的代理方法

/**
  * type == 0 购物车的动画
  * type == 1 阻尼动画
  * isStop: Yes动画结束, No动画过程中
 */
 - (void)JhtAnimationWithType:(NSInteger)type isDidStop:(BOOL)isStop;

Remind

  • ARC
  • iOS >= 8.0
  • iPhone \ iPad

Hope

  • If you find bug when used,Hope you can Issues me,Thank you or try to download the latest code of this framework to see the BUG has been fixed or not
  • If you find the function is not enough when used,Hope you can Issues me,I very much to add more useful function to this framework ,Thank you !

shopcaranimation's People

Contributors

jinht avatar

Watchers

James Cloos avatar  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.