示例#1
0
        public override CCFiniteTimeAction reverse()
        {
            ccBezierConfig r;

            r.endPosition    = CCPointExtension.ccpNeg(m_sConfig.endPosition);
            r.controlPoint_1 = CCPointExtension.ccpAdd(m_sConfig.controlPoint_2, CCPointExtension.ccpNeg(m_sConfig.endPosition));
            r.controlPoint_2 = CCPointExtension.ccpAdd(m_sConfig.controlPoint_1, CCPointExtension.ccpNeg(m_sConfig.endPosition));

            CCBezierBy action = CCBezierBy.actionWithDuration(m_fDuration, r);

            return(action);
        }
示例#2
0
        /// <summary>
        /// Converts a local Point to world space coordinates.The result is in Points.
        /// treating the returned/received node point as anchor relative.
        /// @since v0.7.1
        /// </summary>
        public CCPoint convertToWorldSpaceAR(CCPoint nodePoint)
        {
            CCPoint anchorInPoints;

            if (CCDirector.sharedDirector().ContentScaleFactor == 1)
            {
                anchorInPoints = m_tAnchorPointInPixels;
            }
            else
            {
                anchorInPoints = CCPointExtension.ccpMult(m_tAnchorPointInPixels, 1 / CCDirector.sharedDirector().ContentScaleFactor);
            }

            CCPoint pt = CCPointExtension.ccpAdd(nodePoint, anchorInPoints);

            return(convertToWorldSpace(pt));
        }
示例#3
0
        public override void update(float dt)
        {
            if (m_pTarget != null)
            {
                float xa = 0;
                float xb = m_sConfig.controlPoint_1.x;
                float xc = m_sConfig.controlPoint_2.x;
                float xd = m_sConfig.endPosition.x;

                float ya = 0;
                float yb = m_sConfig.controlPoint_1.y;
                float yc = m_sConfig.controlPoint_2.y;
                float yd = m_sConfig.endPosition.y;

                float x = bezierat(xa, xb, xc, xd, dt);
                float y = bezierat(ya, yb, yc, yd, dt);
                m_pTarget.position = CCPointExtension.ccpAdd(m_startPosition, CCPointExtension.ccp(x, y));
            }
        }