zoukankan      html  css  js  c++  java
  • cocos代码研究(10)ActionEase子类学习笔记

    理论部分

    缓动动作的基类,继承自 ActionInterval类。ActionEase本身是一个抽象的概念父类,开发者最好不要在代码中直接创建它的对象,因为它没有具体的执行效果,这一类的子类速度变化大致可以划分成三种。

    • 由快变慢;
    • 由慢变快;
    • 又慢变快再由快变慢;

    被 EaseBackIn, EaseBackInOut, EaseBackOut, EaseBezierAction, EaseBounce, EaseCircleActionIn, EaseCircleActionInOut, EaseCircleActionOut, EaseCubicActionIn, EaseCubicActionInOut, EaseCubicActionOut, EaseElastic, EaseExponentialIn,EaseExponentialInOut, EaseExponentialOut, EaseQuadraticActionIn, EaseQuadraticActionInOut, EaseQuadraticActionOut, EaseQuarticActionIn, EaseQuarticActionInOut, EaseQuarticActionOut, EaseQuinticActionIn, EaseQuinticActionInOut,EaseQuinticActionOut, EaseRateAction, EaseSineIn, EaseSineInOut , 以及 EaseSineOut 继承.

    代码部分

    EaseRateAction类及其子类被 EaseIn, EaseInOut , EaseOut的API 

    设定速率。
    void setRate (float rate)

    获取速率
    float getRate () const

    用内部动作和速率参数来创建一个动作。
    static EaseRateAction * create (ActionInterval *action, //一个给定的内部动作
    float rate) //一个给定的速率

    用内部动作和速率参数来创建一个由慢到快的动作
    static EaseIn * create (ActionInterval *action, //内部动作。
    float rate) //速率。

    用内部动作和速率参数来创建一个由快到慢的动作。
    static EaseOut * create (ActionInterval *action, //内部动作。
    float rate) //速率。

    用内部动作和速率参数来创建一个从慢到快再从快到慢的动作。
    static EaseInOut * create (ActionInterval *action, //内部动作。
    float rate) //速率。

    实例:

        auto move = MoveBy::create(3, Vec2(VisibleRect::right().x-130,0));
        auto move_back = move->reverse();
        
        auto move_ease_in = EaseIn::create(move->clone(), 2.5f);
        auto move_ease_in_back = move_ease_in->reverse();
        
        auto move_ease_out = EaseOut::create(move->clone(), 2.5f);
        auto move_ease_out_back = move_ease_out->reverse();
  • 相关阅读:
    docker一些基本操作
    Error requesting socket: exit status 255(一个很不错的解决办法)【转】
    十五周至十八周的任务进度
    7月24号day16总结
    7月23号day15总结
    7月22号day14总结
    7月21号day13总结
    7月20号day12总结
    7月19日day11总结
    7月18号day10总结
  • 原文地址:https://www.cnblogs.com/damowang/p/4858750.html
Copyright © 2011-2022 走看看