Jump to content

[HELP] How to create alpha animation for image?


Tokio

Recommended Posts

Posted

I want create a animation for my dx image. The image hide, and appear again continuously. How to make this?

My servers:

Fun:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Derby(DD):

n-560x95_FFFFFF_FFFFFF_000000_000000.png

  • Moderators
Posted (edited)
function render ()
	local timeNow = getTickCount()
	local alpha = (timeNow % 510)
	if alpha > 255 then
		alpha = 255 - (alpha - 255)
	end
	local color = tocolor(255,255,255, alpha)
end

 

Each 1 alpha unit of 255 = 1 millisecond. Very easy example.

Which counts from: 0 > 255 > 0 > 255 > 0 etc.

 


If you want some custom timing: (2s = full animation ON/OFF)

 

local duration = 2000

local alpha = (timeNow % duration / duration) * 510

 

Edited by IIYAMA
  • Thanks 1

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
9 minutes ago, IIYAMA said:

function render ()
	local timeNow = getTickCount()
	local alpha = (timeNow % 510)
	if alpha > 255 then
		alpha = 255 - (alpha - 255)
	end
	local color = tocolor(255,255,255, alpha)
end

 

Each 1 alpha unit of 255 = 1 millisecond. Very easy example.

Which counts from: 0 > 255 > 0 > 255 > 0 etc.

How to slow down? O.o 

My servers:

Fun:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Derby(DD):

n-560x95_FFFFFF_FFFFFF_000000_000000.png

  • Moderators
Posted

See my post, I did edit it afterwards.

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...