Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: jedione on October 25, 2018, 07:00:49 PM

Title: scrolling text to off screen surface...
Post by: jedione on October 25, 2018, 07:00:49 PM
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 (https://youtu.be/DQ2Ee4RrL_U)

code:=
Code: [Select]
//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;

i need it to scroll off surface at the top!       thanks to any one
Title: Re: scrolling text to off screen surface...
Post by: jedione on October 25, 2018, 07:03:52 PM
if any one need a base layout to run and mod i can upload it ,,,
Title: Re: scrolling text to off screen surface...
Post by: 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
Title: Re: scrolling text to off screen surface...
Post by: zpaolo11x on October 26, 2018, 12:42:37 AM
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

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...
Title: Re: scrolling text to off screen surface...
Post by: Giacomo1982 on October 26, 2018, 02:10:46 AM
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 ) );
Title: Re: scrolling text to off screen surface...
Post by: jedione on October 26, 2018, 07:57:46 AM
thanks for the reply,  :D
  almost done

here it is..https://www.youtube.com/watch?v=5B6POnaSbdk&feature=youtu.be (https://www.youtube.com/watch?v=5B6POnaSbdk&feature=youtu.be)
Title: Re: scrolling text to off screen surface...
Post by: rand0m on October 28, 2018, 12:02:52 AM
thanks for the reply,  :D
  almost done

here it is..https://www.youtube.com/watch?v=5B6POnaSbdk&feature=youtu.be (https://www.youtube.com/watch?v=5B6POnaSbdk&feature=youtu.be)

Nice work Jedione, strange request but is it possible to control the flow of text (vertical) by input from keyboard/ gamepad.
Title: Re: scrolling text to off screen surface...
Post by: zpaolo11x on October 28, 2018, 12:15:08 AM
Nice work Jedione, strange request but is it possible to control the flow of text (vertical) by input from keyboard/ gamepad.

The Hystory plugin does something similar although it's not smooth scroll but line by line scrolling
Title: Re: scrolling text to off screen surface...
Post by: dmmarti on November 21, 2019, 08:27:03 AM
Sorry for bringing up an old topic...

@jedione,

Looking at your youtube example, I'm trying to mimic it as well. Are you using the scrolling text module? or do you have other code that you used?

I'd be very interested in seeing how you managed to finally get vertical multi-line overview scrolling working.
Title: Re: scrolling text to off screen surface...
Post by: jedione on November 21, 2019, 01:27:08 PM
i use a surface,  ill send u a nice working theme, of it commented for you to play with..

when i get off work tonight....
Title: Re: scrolling text to off screen surface...
Post by: dmmarti on November 22, 2019, 05:01:46 AM
@jedione,

Thank ya sir.....I appreciate all of the help and work you've done with AM and themes.

This vertical scrolling is one thing that I've always struggled with to get working. Using the scrolling text module almost works right, but if the Overview file is large, it doesn't quite work all the time.

Changing to a surface I hope does better.  I've messed with a surface version before but never figured out how to loop it.

So thanks for the help!
Title: Re: scrolling text to off screen surface...
Post by: jedione on November 22, 2019, 07:20:47 AM
sent u a pm, with a layout... ;)
Title: Re: scrolling text to off screen surface...
Post by: arthurvalenca on November 23, 2019, 10:21:48 AM
Thanks for the work! I would also like to look at this code, could you please send it
Title: Re: scrolling text to off screen surface...
Post by: Spiky on July 11, 2023, 09:28:05 AM
Bringing up an old topic...

I would also be interested in being able to work with this code.
Possible to have it?