Tokio Posted April 8, 2018 Posted April 8, 2018 I want create a animation for my dx image. The image hide, and appear again continuously. How to make this?
Moderators IIYAMA Posted April 8, 2018 Moderators Posted April 8, 2018 (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 April 8, 2018 by IIYAMA 1
Tokio Posted April 8, 2018 Author Posted April 8, 2018 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?
Moderators IIYAMA Posted April 8, 2018 Moderators Posted April 8, 2018 See my post, I did edit it afterwards.
Tokio Posted April 8, 2018 Author Posted April 8, 2018 Just now, IIYAMA said: See my post, I did edit it afterwards. Thank you!! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now