public void Update(double elapsedTime) { if (_tween.IsFinished() != true) { _tween.Update(elapsedTime); _faceSprite.SetWidth((float)_tween.Value()); _faceSprite.SetHeight((float)_tween.Value()); } // This additional alpha tween has been added. if (_alphaTween.IsFinished() != true) { _alphaTween.Update(elapsedTime); _color.Alpha = (float)_alphaTween.Value(); _faceSprite.SetColor(_color); } }
public CharacterSprite CreateSprite(char c) { CharacterData charData = _characterData[c]; Sprite sprite = new Sprite(); sprite.Texture = _texture; // Setup UVs Point topLeft = new Point((float)charData.X / (float)_texture.Width, (float)charData.Y / (float)_texture.Height); Point bottomRight = new Point(topLeft.X + ((float)charData.Width / (float)_texture.Width), topLeft.Y + ((float)charData.Height / (float)_texture.Height)); sprite.SetUVs(topLeft, bottomRight); sprite.SetWidth(charData.Width); sprite.SetHeight(charData.Height); sprite.SetColor(new Color(1, 1, 1, 1)); return new CharacterSprite(sprite, charData); }
public CharacterSprite CreateSprite(char c) { CharacterData charData = _characterData[c]; Sprite sprite = new Sprite(); sprite.Texture = _texture; // Setup UVs Point topLeft = new Point((float)charData.X / (float)_texture.Width, (float)charData.Y / (float)_texture.Height); Point bottomRight = new Point(topLeft.X + ((float)charData.Width / (float)_texture.Width), topLeft.Y + ((float)charData.Height / (float)_texture.Height)); sprite.SetUVs(topLeft, bottomRight); sprite.SetWidth(charData.Width); sprite.SetHeight(charData.Height); sprite.SetColor(new Color(1, 1, 1, 1)); return(new CharacterSprite(sprite, charData)); }