time bars that shows depleting time

fmakawafmakawa Member Posts: 567

Hi Folks, I cant seem to find a current response to this. How do I create a time that gradually disappears as time passes. Like 15 seconds or 30 seconds etc.

Comments

  • tintrantintran Member Posts: 453

    method 1: fades away as time passes
    constraint attribute
    self.color.alpha = 1 - (min(self.time,15)/15)

    method 2: shrinks from 100 pixel width down to zero pixel width
    constraint attribute
    self.size.width = (1 - (min(self.time,15)/15)) * 100

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    This tutorial is a really easy way to display any kind of metered value as a bar. The tutorial references health, but of course it could be use to represent anything you like.

  • fmakawafmakawa Member Posts: 567

    Thanks guys!

Sign In or Register to comment.