Jump to content
×
×
  • Create New...
  • 0

Alpha image problem


Tasho

Question

Hi, I wanted to teste the alpha image trigger but I can't make it work si I come to you :

what I did: 


 

class SpecialBoard(ui.ImageBox):

    timeToFade = 0.100
    interval = 0.1
    fadeIn = 0
    fadeOut = 0
    currentTime = 0
    intervallEndTime = 0
    currentAlphaValue = 0

    def __init__(self):
        ui.ImageBox.__init__(self)

    def __del__(self):
        ui.ImageBox.__del__(self)

    def LoadImage(self, imageName):
        ui.ImageBox.LoadImage(self, imageName)
        self.SetAlpha(0.0)

    def SetAlpha(self, alpha):
        self.currentAlphaValue = alpha
        ui.ImageBox.SetAlpha(self, alpha)

    def OnUpdate(self):
        self.currentTime = time.clock()
        if self.fadeIn == 1 or self.fadeOut == 1:
            if self.currentAlphaValue < 1.0 and self.currentAlphaValue >= 0.0:
                if self.currentTime >= self.intervallEndTime:
                    newAlphaValue = self.currentAlphaValue 
                    if self.fadeIn == 1:
                        newAlphaValue += self.interval
                    else:
                        newAlphaValue -= self.interval
                    self.SetAlpha(newAlphaValue)
                    self.intervallEndTime = self.currentTime + self.timeToFade    
            else:
                self.fadeIn = self.fadeOut = 0

    def FadeIn(self):
        self.Show()
        self.SetAlpha(0.0)
        self.fadeOut = 0
        self.intervallEndTime = self.currentTime + self.timeToFade        
        self.fadeIn = 1

    def FadeOut(self):
        self.Show()
        self.SetAlpha(1.0)
        self.fadeIn = 0
        self.intervallEndTime = self.currentTime + self.timeToFade        
        self.fadeOut = 1

    def fadeProgressFinished(self):
        if self.fadeIn == 0 and self.fadeOut == 0:
            return 1
        else:
            return 0

for ex:

         

   self.Board = SpecialBoard()
            self.Board.SetSize(720, 530)
            self.Board.SetCenterPosition()
            self.Board.Show()
            self.Image = ui.ImageBox()
            self.Image.SetParent(self.Board)
            self.Image.SetPosition(-165, -50)
            self.Image.LoadImage("loading/1.tga")
            self.Image.interval = 0.1
            self.Image.timeToFade = 0.1
            self.Image.Show()
            self.EndLogin.Hide()

 

And nothing happens, what I missed?

Edited by Tasho
Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

3 answers to this question

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 14

      CRK - Cronikal [Play now][Official start on April 24, 2022 at 16:00][11 languages available]

    2. 57

      Forever Metin2

    3. 1

      NPC direct item enchant

    4. 37

      Official Mailbox

    5. 0

      [Request] Underground-MT2 Serverfiles, Database , Homepage & Client

    6. 0

      3 countries 3 phrases

    7. 1

      NPC direct item enchant

    8. 0

      Origins2 Global | International | A new concept - 10.06.2022

  • Recently Browsing

    • No registered users viewing this page.

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.