import arcade
from menu import MainMenu

class LogoView(arcade.View):
  def __init__(self):
    super().__init__()
    self.screen = (self.window.width,self.window.height)
    self.logo = arcade.Sprite('./assets/logo.png',scale=1.0)
    self.logo.position = (self.screen[0]//2,self.screen[1]//2)
    self.logo.alpha = 0
    self.logo.onshow = True
    self.spl = arcade.SpriteList()
    self.spl.append(self.logo)

  def on_update(self,delta_time):
    if self.logo.onshow:
      self.logo.alpha += 127*delta_time
      if self.logo.alpha >= 255:
        self.logo.onshow = False
    else:
      self.logo.alpha -= 127*delta_time
      if self.logo.alpha <= 0:
        self.window.show_view(MainMenu())
  def on_draw(self):
    self.clear()
    self.spl.draw()
