procedure TfrmGame.CreateTextAnimation(i, j: Integer; Const aValue: string; aTextType: TTextType);
var
lText: TText;
lEffect: TGlowEffect;
lAni: TFloatAnimation;
begin
lText := TText.Create(nil);
lText.Parent := BoardLayout;
lText.Text := aValue;
lText.WordWrap := False;
lText.AutoSize := True;
lText.Position.X := i * fCellWidth;
lText.Position.Y := j * fCellHeight;
lText.HitTest := False;
lText.Font.Style := [TFontStyle.fsBold];
lText.BringToFront;
lEffect := TGlowEffect.Create(lText);
lEffect.Parent := lText;
lAni := TFloatAnimation.Create(lText);
lAni.Parent := lText;
lAni.PropertyName := 'Position.Y';
lAni.StartValue := lText.Position.Y;
lAni.StopValue := lAni.StartValue - fCellHeight;
lAni.OnFinish := DoTextFinish;
case aTextType of
ttScore:
begin
lText.Font.Size := 15;
lText.Color := TAlphaColorRec.White;
lEffect.GlowColor := TAlphaColorRec.Black;
lEffect.Softness := 0;
lAni.Duration := 2;
end;
ttMultiplier:
begin
lText.Font.Size := 30;
lText.Color := TAlphaColorRec.Magenta;
lEffect.GlowColor := TAlphaColorRec.Black;
lEffect.Softness := 0;
lAni.Duration := 4;
lText.BringToFront;
end;
end;
lAni.Start;
end;
Head over and download the full source code of the Bejeweled clone in Delphi XE6 Firemonkey.