public CCSkewByState(CCSkewBy action, CCNode target) : base(action, target) { DeltaX = SkewX = action.SkewByX; DeltaY = SkewY = action.SkewByY; EndSkewX = StartSkewX + DeltaX; EndSkewY = StartSkewY + DeltaY; }
public SpriteBatchNodeOffsetAnchorSkewScale() { CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache; cache.AddSpriteFrames("animations/grossini.plist"); cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray"); // Create animations and actions var animFrames = new List <CCSpriteFrame>(); string tmp = ""; for (int j = 0; j < 14; j++) { string temp = ""; if (j + 1 < 10) { temp = "0" + (j + 1); } else { temp = (j + 1).ToString(); } tmp = string.Format("grossini_dance_{0}.png", temp); CCSpriteFrame frame = cache[tmp]; animFrames.Add(frame); } animation = new CCAnimation(animFrames, 0.3f); // skew CCSkewBy skewX = new CCSkewBy(2, 45, 0); CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse(); CCSkewBy skewY = new CCSkewBy(2, 0, 45); CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse(); // scale CCScaleBy scale = new CCScaleBy(2, 2); CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse(); seq_scale = new CCSequence(scale, scale_back); seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_back); sprites = new CCSprite[numOfSprites]; pointSprites = new CCSprite[numOfSprites]; for (int i = 0; i < numOfSprites; i++) { // Animation using Sprite batch sprites[i] = new CCSprite("grossini_dance_01.png"); pointSprites[i] = new CCSprite("Images/r1"); CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini"); AddChild(spritebatch); AddChild(pointSprites[i], 200); spritebatch.AddChild(sprites[i], i); } }
public CCSkewByState (CCSkewBy action, CCNode target) : base (action, target) { DeltaX = SkewX = action.SkewByX; DeltaY = SkewY = action.SkewByY; EndSkewX = StartSkewX + DeltaX; EndSkewY = StartSkewY + DeltaY; }
public override void OnEnter() { base.OnEnter(); centerSprites(3); var actionTo = new CCSkewTo(2, 37.2f, -37.2f); var actionToBack = new CCSkewTo(2, 0, 0); var actionBy = new CCSkewBy(2, 0.0f, -90.0f); var actionBy2 = new CCSkewBy(2, 45.0f, 45.0f); var actionByBack = actionBy.Reverse(); m_tamara.RunAction(CCSequence.FromActions(actionTo, actionToBack)); m_grossini.RunAction(CCSequence.FromActions(actionBy, actionByBack)); m_kathia.RunAction(CCSequence.FromActions(actionBy2, actionBy2.Reverse())); }
public override void onEnter() { base.onEnter(); centerSprites(3); CCActionInterval actionTo = CCSkewTo.actionWithDuration(2, 37.2f, -37.2f); CCActionInterval actionToBack = CCSkewTo.actionWithDuration(2, 0, 0); CCActionInterval actionBy = CCSkewBy.actionWithDuration(2, 0.0f, -90.0f); CCActionInterval actionBy2 = CCSkewBy.actionWithDuration(2, 45.0f, 45.0f); CCFiniteTimeAction actionByBack = actionBy.reverse(); m_tamara.runAction(CCSequence.actions(actionTo, actionToBack)); m_grossini.runAction(CCSequence.actions(actionBy, actionByBack)); m_kathia.runAction(CCSequence.actions(actionBy2, actionBy2.reverse())); }
public new static CCSkewBy actionWithDuration(float t, float deltaSkewX, float deltaSkewY) { CCSkewBy pSkewBy = new CCSkewBy(); if (pSkewBy != null) { if (pSkewBy.initWithDuration(t, deltaSkewX, deltaSkewY)) { //pSkewBy->autorelease(); } else { //CC_SAFE_DELETE(pSkewBy); } } return pSkewBy; }
public new static CCSkewBy actionWithDuration(float t, float deltaSkewX, float deltaSkewY) { CCSkewBy pSkewBy = new CCSkewBy(); if (pSkewBy != null) { if (pSkewBy.initWithDuration(t, deltaSkewX, deltaSkewY)) { //pSkewBy->autorelease(); } else { //CC_SAFE_DELETE(pSkewBy); } } return(pSkewBy); }
public SpriteOffsetAnchorSkew() { CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache; cache.AddSpriteFrames("animations/grossini.plist"); cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray"); sprites = new CCSprite[numOfSprites]; pointSprites = new CCSprite[numOfSprites]; var animFrames = new List <CCSpriteFrame>(); string tmp = ""; for (int j = 0; j < 14; j++) { tmp = string.Format("grossini_dance_{0:00}.png", j + 1); CCSpriteFrame frame = cache[tmp]; animFrames.Add(frame); } animation = new CCAnimation(animFrames, 0.3f); // Skew CCSkewBy skewX = new CCSkewBy(2, 45, 0); CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse(); CCSkewBy skewY = new CCSkewBy(2, 0, 45); CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse(); seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_back); for (int i = 0; i < numOfSprites; i++) { // Animation using Sprite batch sprites[i] = new CCSprite("grossini_dance_01.png"); AddChild(sprites[i], 0); pointSprites[i] = new CCSprite("Images/r1"); AddChild(pointSprites[i], 1); } }
public SpriteBatchNodeOffsetAnchorSkew() { CCSize s = CCDirector.SharedDirector.WinSize; for (int i = 0; i < 3; i++) { CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache; cache.AddSpriteFramesWithFile("animations/grossini.plist"); cache.AddSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray"); // // Animation using Sprite batch // CCSprite sprite = new CCSprite("grossini_dance_01.png"); sprite.Position = (new CCPoint(s.Width / 4 * (i + 1), s.Height / 2)); CCSprite point = new CCSprite("Images/r1"); point.Scale = 0.25f; point.Position = sprite.Position; AddChild(point, 200); switch (i) { case 0: sprite.AnchorPoint = new CCPoint(0, 0); break; case 1: sprite.AnchorPoint = new CCPoint(0.5f, 0.5f); break; case 2: sprite.AnchorPoint = new CCPoint(1, 1); break; } point.Position = sprite.Position; CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini"); AddChild(spritebatch); var animFrames = new List <CCSpriteFrame>(); string tmp = ""; for (int j = 0; j < 14; j++) { string temp = ""; if (j + 1 < 10) { temp = "0" + (j + 1); } else { temp = (j + 1).ToString(); } tmp = string.Format("grossini_dance_{0}.png", temp); CCSpriteFrame frame = cache.SpriteFrameByName(tmp); animFrames.Add(frame); } CCAnimation animation = new CCAnimation(animFrames, 0.3f); sprite.RunAction(new CCRepeatForever(new CCAnimate(animation))); animFrames = null; CCSkewBy skewX = new CCSkewBy(2, 45, 0); CCActionInterval skewX_back = (CCActionInterval)skewX.Reverse(); CCSkewBy skewY = new CCSkewBy(2, 0, 45); CCActionInterval skewY_back = (CCActionInterval)skewY.Reverse(); CCFiniteTimeAction seq_skew = CCSequence.FromActions(skewX, skewX_back, skewY, skewY_back); sprite.RunAction(new CCRepeatForever((CCActionInterval)seq_skew)); spritebatch.AddChild(sprite, i); } }
protected CCSkewBy(CCSkewBy skewBy) : base(skewBy) { InitWithDuration(skewBy.m_fDuration, skewBy.m_fSkewX, skewBy.m_fSkewY); }
public SpriteOffsetAnchorSkewScale() { CCSize s = CCDirector.sharedDirector().getWinSize(); for (int i = 0; i < 3; i++) { CCSpriteFrameCache cache = CCSpriteFrameCache.sharedSpriteFrameCache(); cache.addSpriteFramesWithFile("animations/grossini"); cache.addSpriteFramesWithFile("animations/grossini_gray", "animations/images/grossini_gray"); // // Animation using Sprite batch // CCSprite sprite = CCSprite.spriteWithSpriteFrameName("grossini_dance_01.png"); sprite.position = (new CCPoint(s.width / 4 * (i + 1), s.height / 2)); CCSprite point = CCSprite.spriteWithFile("Images/r1"); point.scale = 0.25f; point.position = sprite.position; addChild(point, 1); switch (i) { case 0: sprite.anchorPoint = new CCPoint(0, 0); break; case 1: sprite.anchorPoint = (new CCPoint(0.5f, 0.5f)); break; case 2: sprite.anchorPoint = (new CCPoint(1, 1)); break; } point.position = sprite.position; List <CCSpriteFrame> animFrames = new List <CCSpriteFrame>(); string tmp = ""; for (int j = 0; j < 14; j++) { string temp = ""; if (j + 1 < 10) { temp = "0" + (j + 1); } else { temp = (j + 1).ToString(); } tmp = string.Format("grossini_dance_{0}.png", temp); CCSpriteFrame frame = cache.spriteFrameByName(tmp); animFrames.Add(frame); } CCAnimation animation = CCAnimation.animationWithFrames(animFrames); sprite.runAction(CCRepeatForever.actionWithAction(CCAnimate.actionWithDuration(2.8f, animation, false))); animFrames = null; // Skew CCSkewBy skewX = CCSkewBy.actionWithDuration(2, 45, 0); CCActionInterval skewX_back = (CCActionInterval)skewX.reverse(); CCSkewBy skewY = CCSkewBy.actionWithDuration(2, 0, 45); CCActionInterval skewY_back = (CCActionInterval)skewY.reverse(); CCFiniteTimeAction seq_skew = CCSequence.actions(skewX, skewX_back, skewY, skewY_back); sprite.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq_skew)); // Scale CCScaleBy scale = CCScaleBy.actionWithDuration(2, 2); CCActionInterval scale_back = (CCActionInterval)scale.reverse(); CCFiniteTimeAction seq_scale = CCSequence.actions(scale, scale_back); sprite.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq_scale)); addChild(sprite, 0); } }
protected CCSkewBy(CCSkewBy skewBy) : base(skewBy) { InitWithDuration(skewBy.m_fDuration, skewBy.m_fSkewX, skewBy.m_fSkewY); }