Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17098

Cocostudio: animate in tween duration (code share)

$
0
0

@MikhailSh wrote:

It's a simple solution for performing animation from current state (like animateInTweenDuration in cocosbuilder).
It firstly animates from current state to first frame in specified duration and only after actually performs animation.
It's especially useful for UI state transition animations like transition between button states - normal, highlighted, disabled, selected. So instead of creating each possible transition animation (normal->highlighted, normal->selected, selected->hightlighted,....), can be created just four states with one-frame animation duration. And we can switch to these states with or without animation.

Usage:

    auto timeline = TweenActionTimelineCreator::createTweenActionTimeline(
          this, "Button.csb", "Selected", 10);
    runAction(timeline);
    timeline->gotoFrameAndPlay(0, false);
    timeline->setLastFrameCallFunc([this, timeline]() {
        this->stopAction(timeline);
    });

It will perform animation from current state to 'Selected' state in 10 frames.

It would be great if this functionality could be added to ActionTimeline. But i think there is a better way of implementing this.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17098

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>