public static CCCatmullRomBy create(float dt, CCPointArray points) { CCCatmullRomBy cCCatmullRomBy = new CCCatmullRomBy(); cCCatmullRomBy.initWithDuration(dt, points); return(cCCatmullRomBy); }
/** 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); }
public override void OnEnter() { base.OnEnter(); centerSprites(2); var s = CCDirector.SharedDirector.WinSize; // // sprite 1 (By) // // startPosition can be any coordinate, but since the movement // is relative to the Catmull Rom curve, it is better to start with (0,0). // m_tamara.Position = new CCPoint(50, 50); m_pArray.Clear(); m_pArray.Add(new CCPoint(0, 0)); m_pArray.Add(new CCPoint(80, 80)); m_pArray.Add(new CCPoint(s.Width - 80, 80)); m_pArray.Add(new CCPoint(s.Width - 80, s.Height - 80)); m_pArray.Add(new CCPoint(80, s.Height - 80)); m_pArray.Add(new CCPoint(80, 80)); m_pArray.Add(new CCPoint(s.Width / 2, s.Height / 2)); var action = new CCCatmullRomBy (3, m_pArray); var reverse = action.Reverse(); CCFiniteTimeAction seq = CCSequence.FromActions(action, reverse); m_tamara.RunAction(seq); // // sprite 2 (To) // // The startPosition is not important here, because it uses a "To" action. // The initial position will be the 1st point of the Catmull Rom path // m_pArray2.Clear(); m_pArray2.Add(new CCPoint(s.Width / 2, 30)); m_pArray2.Add(new CCPoint(s.Width - 80, 30)); m_pArray2.Add(new CCPoint(s.Width - 80, s.Height - 80)); m_pArray2.Add(new CCPoint(s.Width / 2, s.Height - 80)); m_pArray2.Add(new CCPoint(s.Width / 2, 30)); var action2 = new CCCatmullRomTo (3, m_pArray2); var reverse2 = action2.Reverse(); CCFiniteTimeAction seq2 = CCSequence.FromActions(action2, reverse2); m_kathia.RunAction(seq2); }
public static CCCatmullRomBy actionWithDuration(float dt, CCPointArray points) { return(CCCatmullRomBy.create(dt, points)); }