欢迎光临
我们一直在努力

ThinkVerb 超酷的枪型动画库!

建站超值云服务器,限时71元/月

ThinkVerb 超酷的枪型动画库!

项目介绍:

详见github:https://github.com/hon-key/ThinkVerb

demo 里有示例代码,注释也比较清楚,不过我写的是英文

ThinkVerb

ThinkVerb is an Animation Interface based on CoreAnimation, it help you make CAAnimation for view’s layer easily. ThinkVerb uses chain programming style to mak CAAnimation. Most of the time you just need to type one line of code to make an animation even if it is complicated. So you can do animation anywhere easily and the code is so human readable.

Usage

ThinkVerb just have one entrance,that is TVAnimation of an UIView,it is a manager of animation sprite,all you need to do is make an animation sprite using a TVAnimation and then activate it.

Take an example,if you want to rotate an UIView forever,just type:
NSString rotation = view.TVAnimation.rotate.z.endAngle(M_PI 2).repeat(-1).activate();
The code rotate your view around the z axis from current angle to endAngle, asume that the current angle is 0, your view will make a turn. repeat(-1) make this animation repeat forever. At last you just need to call activate() and the animation will automatically run.

If you want to stop rotation, most of time you just need to type:
view.TVAnimation.clear();
The action clear all animations of the view. You can also type:
view.TVAnimation.existSprite(rotation).stop();
The action stop and release the rotation animation

You can see more animation example in ThinkVerbDemo project

You can combine any animation,even like a gun:

view.TVAnimation.appearance.duration(3).timing(TVTiming.extremeEaseOut).end();
view.TVAnimation.contents.drawRange(nil,[UIImage imageNamed:@"1"]).didStop(^{
    view.TVAnimation.contents.drawRange([UIImage imageNamed:@"1"],[UIImage imageNamed:@"2"]).didStop(^{
        view.TVAnimation.contents.drawRange([UIImage imageNamed:@"2"],[UIImage imageNamed:@"3"]).didStop(^{
            view.TVAnimation.contents.drawRange([UIImage imageNamed:@"3"],[UIImage imageNamed:@"2"]).activate();
        }).activate();
    }).activate();
}).activate();

Installation

Using cocoapods

pod ‘ThinkVerb’

Copy files

Copy all files from Thinkverb fold to your project

Indexes

Basic

move animate your view’s position from one place to another place, position is related to anchorPoint

scale scale your view with times param

rotate rotate your view around x/y/z axis

shadow animate shadow offset/opacity/radius/color of a view,

bounds aniamte bounds of a view’s layer,bounds,the effect is related to view position

anchor animate anchorPoint,normally you should animate anchor with other related animations

translate animte your view’s position using offset, can be apply to sublayer

fade animate your view’s opacity

contents animate bitmap of layer,using rect to animate rectangle of bitmap with range of [0 0 1 1],etc

backgroundColor aniamte background color of an UIView

cornerRadius animate cornerRadius of an UIView

border animate border’s width and color of an UIView

path animate transition path of an UIView’s layer

Appearance

appearance sprite is used to configure default value to all sprite of an UIView, take an example,if you want all animation keep alive when finished,you may do it like this before you make any sprite:

view.TVAnimation.appearance.keepAlive(YES).end();

License

ThinkVerb is released under the MIT license. See LICENSE for details.

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ThinkVerb 超酷的枪型动画库!
分享到: 更多 (0)