Make Text Bigger

Hi all,

I had a quick question on display.newText and functions.

Currently I am using a display.newText for the score of my game, and would like it so that each time a player earns a point, the font size increases a bit then goes back to its original size (scaling animation).

If this is possible (and if anybody knows how to do this), that would be great.

Here’s my code:

scoreTxt = display.newText( "0", 0, 0, "Roboto", 64 ) scoreTxt.x = \_X / 2 scoreTxt.y = \_Y / 10 scoreTxt:setFillColor( .141, .160, .152 ) scoreTxt.anchorX = .5 

local function onTap(event) score = score + 1 scoreTxt.text = "" .. score end Runtime:addEventListener( "tap", onTap ) 

Runtime:addEventListener( “tap”, onTap )

Thanks!

Try this:

local function highlightScore() local function shrinkScore() transition.to(scoreTxt, {xScale = 1, yScale = 1, time = 500, easing = inSine }) end transition.to(scoreTxt, {time = 500, xScale = 1.8, yScale = 1.8, easing = outSine, onComplete = shrinkScore}) end

Just something I had lying around.

Btw, if you want to keep the score’s alignment, you can adjust its anchorX/anchorY properties.

Thank you so much! It works flawlessly :slight_smile:

Try this:

local function highlightScore() local function shrinkScore() transition.to(scoreTxt, {xScale = 1, yScale = 1, time = 500, easing = inSine }) end transition.to(scoreTxt, {time = 500, xScale = 1.8, yScale = 1.8, easing = outSine, onComplete = shrinkScore}) end

Just something I had lying around.

Btw, if you want to keep the score’s alignment, you can adjust its anchorX/anchorY properties.

Thank you so much! It works flawlessly :slight_smile: