Attract-Mode Support > Scripting

scrolling text to off screen surface...

(1/3) > >>

jedione:
ok well im trying to make it so we can have text overview's that will scroll and loop

with the beginning and end going off the surface layer...   here it is using anime on a surface.

iv been onley able to have it start off screen,   than end.....   i need help to make it happen

what do you think....

demo= https://youtu.be/DQ2Ee4RrL_U

code:=

--- Code: ---//surface anime
local snap = fe.add_surface(1200,1000)
//snap.set_pos = (100,100);
local snapy = snap.add_text("[Overview]", 100, 1200, 800, 900 );

local layer_cfg = {
when = Transition.ToNewSelection,
property = "y",
start = 900,
end = 500,
tween = Tween.Linear,
time = 15000,
delay = 0,
loop = true
}

animation.add( PropertyAnimation( snapy, layer_cfg ) );

snapy.word_wrap = true;
snapy.align = Align.TopLeft;
snapy.set_rgb (0,0,0);
snapy.font="blogger";
snapy.charsize = 28;
//snapy.alpha = 255;
--- End code ---

i need it to scroll off surface at the top!       thanks to any one

jedione:
if any one need a base layout to run and mod i can upload it ,,,

Giacomo1982:
This is what I'm looking for, but it is not perfect, the text in your example start from the bottom and when is on top restart.
I can't understand the surface  purpose, actually surface in general... Maybe surface is a container of objects?
I need a command that moves text inside its box

zpaolo11x:

--- Quote from: Giacomo1982 on October 25, 2018, 11:43:05 PM ---This is what I'm looking for, but it is not perfect, the text in your example start from the bottom and when is on top restart.
I can't understand the surface  purpose, actually surface in general... Maybe surface is a container of objects?
I need a command that moves text inside its box

--- End quote ---

Giacomo, I made something vaguely similar to your needs in my theme for scrolling horizontal titles that are longer than the screen width, it's a real mess, I swear, especially if you want the text to "ping pong". Take a look at the bottom of my code, I'll try to isolate an example if I find some time...

Giacomo1982:
Thanks Paolo, I decided to make a scroller by myself

local flw = fe.layout.width
local flh = fe.layout.height

class scroller {

   text = null
   time = null
   delay = null
   direction = null      // left, right, top, down
   end = null
   start = null
   current_tick_time = null
   
   constructor( text_name, anim_time, anim_delay, anim_direction, anim_end ) {
      text = text_name;
      time = anim_time;
      delay = anim_delay;
      direction = anim_direction;
      end = anim_end;

      anim_prop()
      fe.add_ticks_callback( this, "move" )
      fe.add_transition_callback( this, "change_game" )
   }

   function anim_prop() {
      current_tick_time = 0
      switch ( direction ) {
         case "top":
            start = text.y;
            end = text.y - end;
            break;
         case "down":
            start = text.y;
            end = text.y + end;
            break;
         case "left":
            start = text.x;
            end = text.x - end;
            break;
         case "right":
            start = text.x;
            end = text.x + end;
            break;
      }
   }

   function move( tick_time ) {
      if ( current_tick_time == 0 ) {
         current_tick_time = tick_time + delay         // assign the current tick_time value to current_tick_time (it not increase durign time)
         if ( direction == "top" || direction == "down" ) text.y = start
         else text.x = start
      }
      local anim_time = tick_time - current_tick_time      // anim_time increase every 16.6ms
      if ( current_tick_time < tick_time ) {
         switch ( direction ) {
            case "top":      if ( text.y > end )      text.y = start - anim_time / time;      break;      // do the movement
            case "down":   if ( text.y < end )      text.y = start + anim_time / time;      break;
            case "left":   if ( text.x > end )      text.x = start - anim_time / time;      break;
            case "right":   if ( text.x < end )      text.x = start + anim_time / time;      break;
         }
      }
   }

   function change_game( ttype, var, ttime ) {
      if ( ttype == Transition.ToNewList || ttype == Transition.ToNewSelection || ttype == Transition.ToNewList )
         current_tick_time = 0                     // assign value 0 to if game changes
   }   
}


local surface = fe.add_surface( flw*0.30, flh*0.30 );
surface.x = 50;
surface.y = 50;
local mytext = surface.add_text( "[Extra]", 0, 0, flw*0.30, flh*0.60 );
mytext.charsize = 15;
mytext.word_wrap = true;
mytext.align = Align.TopLeft;
mytext.set_bg_rgb( 255, 0, 0 );
scroller( mytext, 10, 500, "left", 50 );      // class call




but thanks to jedione I realized is easier using animation module with the text inside a surface




fe.load_module("animate");
local flw = fe.layout.width
local flh = fe.layout.height

local surface = fe.add_surface( flw/3, flh/3 );
surface.x = 100;
surface.y = 200;
local text = surface.add_text( "[Extra]", 0, 0, flw, flh );
text.charsize = 15;
text.word_wrap = true;
text.align = Align.TopLeft;
text.set_bg_rgb( 255, 0, 0 );
      
local an = { when=Transition.ToNewSelection, property="y", start=text.y, end=text.y-200, time=1000 }
animation.add( PropertyAnimation( text, an ) );

Navigation

[0] Message Index

[#] Next page

Go to full version