F
F
Fantiney2013-07-30 10:05:20
linux
Fantiney, 2013-07-30 10:05:20

Plymouth script?

Wrote such a simple script.

# This is a simple testing script for Plymouth daemon.

Window.SetBackgroundTopColor (0.16, 0.00, 0.12);    
Window.SetBackgroundBottomColor (0.16, 0.00, 0.12);  
logo.image = Image ("ubuntu_logo16.png"); //выбираем изображение логотипа

logo.sprite = Sprite (); //создаем новый спрайт
logo.sprite.SetImage (logo.image);

logo.width = logo.image.GetWidth ();
logo.height = logo.image.GetHeight ();
logo.x = Window.GetX () + Window.GetWidth () / 2 - logo.width  / 2; 
logo.y = Window.GetY () + Window.GetHeight () / 2 - logo.height;
logo.z = 1000; 

logo.sprite.SetX (logo.x); //задаём координаты логотипа
logo.sprite.SetY (logo.y);
logo.sprite.SetZ (logo.z);

logo.sprite.SetOpacity (1);


light.image = Image ("light.png");

light.sprit = Sprite (light.image);

light.width = light.image.GetWidth ();
light.height = light.image.GetHeight ();
llight.x = Window.GetX () + Window.GetWidth () / 2 - llight.width  / 2; 
light.y = Window.GetY () + Window.GetHeight () / 2 - light.height;
light.z = 100; 

light.sprite.SetX (light.x);
light.sprite.SetY (light.y);
light.sprite.SetZ (light.z);

#light.sprite.SetOpacity (1);

fun pulse ()
 {
  int flag;
  float counter;
  if (flag = 0)
  {if (counter < 1)
    {
    counter = counter + 0.02;
    light.sprite.SetOpacity (counter);
    }
    else
    flag = 1;
  }	
  else
  {if (counter > 0)
    {		
    counter = counter - 0.02;
    light.sprite.SetOpacity (counter);
    }
    else
    flag = 0;
  }
 }

Plymouth.SetRefreshFunction (pulse);

It should work simply: draw two pictures and dynamically change the transparency of the second one. He copes with the first part with a bang, but the second does not.
Help, please, to find errors.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fantiney, 2013-08-29
@Fantiney

In short, I decided. Here is a working version:

# This is a simple pulsing script for Plymouth daemon.

Window.SetBackgroundTopColor (0.16, 0.00, 0.12);    
Window.SetBackgroundBottomColor (0.16, 0.00, 0.12);  

logo.image = Image("ubuntu_logo.png"); 

logo.sprite = Sprite (logo.image); 


logo.width = logo.image.GetWidth ();
logo.height = logo.image.GetHeight ();
logo.x = Window.GetX () + Window.GetWidth () / 2 - logo.width  / 2; 
logo.y = Window.GetY () + Window.GetHeight () / 2 - logo.height / 2;
logo.z = 1000; 

logo.sprite.SetX (logo.x); 
logo.sprite.SetY (logo.y);
logo.sprite.SetZ (logo.z);

logo.sprite.SetOpacity (1);

light.image = Image ("light.png");

light.sprite = Sprite (light.image);

light.width = light.image.GetWidth ();
light.height = light.image.GetHeight ();
light.x = Window.GetX () + Window.GetWidth () / 2 - light.width  / 2; 
light.y = Window.GetY () + Window.GetHeight () / 2 - light.height / 2;
light.z = 100; 

light.sprite.SetX (light.x);
light.sprite.SetY (light.y);
light.sprite.SetZ (light.z);

#light.sprite.SetOpacity (1);

flag = 0;
counter = 1;

fun pulse ()
 {
  
  if (counter < 0.05)
    flag = 1;
  if (counter > 0.95)
    flag = 0;

  if (flag == 0) {
    counter = counter - 0.02;		
    light.sprite.SetOpacity (counter);
      }
  if (flag == 1) {
    counter = counter + 0.02;		
    light.sprite.SetOpacity (counter);
      }
 }

Plymouth.SetRefreshFunction (pulse);

F
Fantiney, 2013-08-06
@Fantiney

Is there really no person on Habré who knows Plymouth Scripting Language? Or C++?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question