문제

Need to have a way to "scale by" without using an SKAction, but it should mimic changes to SKNode as scaleBy:duration: method does.

How does scale factor changes on the node which was "scaledBy"?

도움이 되었습니까?

해결책

My guess is that there's some kind of action manager running its own update: method (like what SKScene has) and updates the appropriate properties (in this case xScale and yScale) of the node attached to the action on each callback.

The update: method takes an NSTimeInterval parameter that can be used to know how far along the animation to progress and when to finish.

EDIT

In cocos2d-x, the CCScaleBy action is a subclass of CCScaleTo. The update method goes something like this:

void CCScaleTo::update(float time)
{
    setScaleX(m_fStartScaleX + m_fDeltaX * time);
    setScaleY(m_fStartScaleY + m_fDeltaY * time);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top