Exemplo n.º 1
0
        /** creates an action with a Cardinal Spline array of points and tension */
        public static CCCatmullRomBy create(float dt, CCPointArray points)
        {
            CCCatmullRomBy by = new CCCatmullRomBy();

            by.initWithDuration(dt, points);
            return(by);
        }
Exemplo n.º 2
0
        /** creates an action with a Cardinal Spline array of points and tension */
        public static CCCardinalSplineTo create(float duration, CCPointArray points, float tension)
        {
            CCCardinalSplineTo ret = new CCCardinalSplineTo();

            ret.initWithDuration(duration, points, tension);
            return(ret);
        }
Exemplo n.º 3
0
        /** initializes the action with a duration and an array of points */
        public virtual bool initWithDuration(float dt, CCPointArray points)
        {
            if (base.initWithDuration(dt, points, 0.5f))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        /** initializes the action with a duration and an array of points */
        public virtual bool initWithDuration(float duration, CCPointArray points, float tension)
        {
            if (points == null || points.count() == 0)
            {
                return(false);
            }
            if (base.initWithDuration(duration))
            {
                setPoints(points);
                m_fTension = tension;

                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        public virtual CCActionInterval reverse()
        {
            CCPointArray copyConfig = (CCPointArray)m_pPoints.copy();

            //
            // convert "absolutes" to "diffs"
            //
            CCPoint p = copyConfig.getControlPointAtIndex(0);

            for (int i = 1; i < copyConfig.count(); ++i)
            {
                CCPoint current = copyConfig.getControlPointAtIndex(i);
                CCPoint diff    = current.Sub(p);
                copyConfig.replaceControlPoint(diff, i);

                p = current;
            }


            // convert to "diffs" to "reverse absolute"

            CCPointArray pReverse = copyConfig.reverse();

            // 1st element (which should be 0,0) should be here too

            p = pReverse.getControlPointAtIndex(pReverse.count() - 1);
            pReverse.removeControlPointAtIndex(pReverse.count() - 1);

            p = p.Neg();
            pReverse.insertControlPoint(p, 0);

            for (int i = 1; i < pReverse.count(); ++i)
            {
                CCPoint current = pReverse.getControlPointAtIndex(i);
                current = current.Neg();
                CCPoint abs = current.Add(p);
                pReverse.replaceControlPoint(abs, i);

                p = abs;
            }

            return(CCCardinalSplineBy.create(m_fDuration, pReverse, m_fTension));
        }
Exemplo n.º 6
0
 /** creates an action with a Cardinal Spline array of points and tension
  * @deprecated: This interface will be deprecated sooner or later.
  */
 public static new CCCardinalSplineTo actionWithDuration(float duration, CCPointArray points, float tension)
 {
     return(CCCardinalSplineTo.create(duration, points, tension));
 }
Exemplo n.º 7
0
 public virtual void setPoints(CCPointArray points)
 {
     m_pPoints = points;
 }
Exemplo n.º 8
0
        public virtual CCActionInterval reverse()
        {
            CCPointArray pReverse = m_pPoints.reverse();

            return(CCCardinalSplineTo.create(m_fDuration, pReverse, m_fTension));
        }
Exemplo n.º 9
0
        public CCPointArray copy()
        {
            CCPointArray copy = new CCPointArray(m_pControlPoints);

            return(copy);
        }
Exemplo n.º 10
0
 /** creates an action with a Cardinal Spline array of points and tension
  */
 public static CCCatmullRomBy actionWithDuration(float dt, CCPointArray points)
 {
     return(CCCatmullRomBy.create(dt, points));
 }