Attract-Mode Support > Scripting
ScrollingText module
liquid8d:
Hey all... put together this module because I wanted scrolling text. Still a bit of a WIP, so you'll probably see some goofy things, but feel free to play around with it and give me any feedback..
https://www.youtube.com/watch?v=3YZWja4z7sk
It works by creating a surface and a text object for each scrolling text. Use is basically:
--- Code: ---fe.load_module("objects/scrollingtext");
local scroller = ScrollingText.add( "[Title]", 25, 50, fe.layout.width - 25, 75, ScrollType.HORIZONTAL_LEFT );
//there is a couple wrapper functions for color:
scroller.set_rgb( 255, 0, 0 ); //the text color
scroller.set_bg_rgb( 0, 0, 0 ); //the surface color (uses a pixel.png to color the surface)
//scroller.set_pos( 0, 0, 100, 100 ); //the surface x, y, w, h
//you can access the surface and text objects directly
//scroller.surface <- the surface
//scroller.text <- the text object
//There are also some settings:
scroller.settings.delay = 500;
scroller.settings.loop = -1;
--- End code ---
The module is in my github in modules/objects (make sure to grab the .nut and the folder and put it in modules/objects):
https://github.com/liquid8d/attract-extra/tree/master/modules/objects
A sample layout is available there as well:
https://github.com/liquid8d/attract-extra/tree/master/layouts/sample_objects_scrollingtext
For details on use, look in the modules/objects/scrollingtext.nut file
jedione:
thanks this is great
Q: is their a way to change the Font?
liquid8d:
I sent a direct msg to you, but I'll post here in case anyone is interested:
The scroller object you get is a custom object (composed of multiple objects, a surface and the text object that scrolls). You can access the text object from scroller.text so any properties of an FeText object can be modified there:
scroller.text.font = "font";
jedione:
thanks will be trying this.....
jedione:
so i got it working and is good i also made it work with animation...but with animation
it needs to start behind something and end behind something,, were as the scrollingtext module
it goes right off the ends hidden witch is good , i can put it in tighter spots !
Q: using "ScrollType.HORIZONTAL_LEFT" after it disapers out the end of the surface
it takes about 7 sec before it will show up on the right side again for a loop.
How can i change this so as the last tail end is going of the surface as it is starting at the other end again?
heres both codes..
//*****scrolingtext module******
local scroller1 = ScrollingText.add( "[Title]", 25, 50, 300, 45, ScrollType.HORIZONTAL_LEFT );
scroller1.set_bg_rgb(0, 220, 0, 150);
scroller1.set_rgb( 255, 0, 0 );
scroller1.text.font = "time";
scroller1.text.charsize = 25;
scroller1.set_pos( 200, 500, 400, 30 );
//*****scrolling text anime********
::OBJECTS <- {
logo = fe.add_text("[Title]", 850, 202, 195, 050 ),
}
local pac = {
when = Transition.StartLayout ,property = "x", start = 1150, end = 580, tween = Tween.Linear, time = 7000, delay = 000, loop = true
}
animation.add( PropertyAnimation( OBJECTS.logo, pac ) );
OBJECTS.logo.font="time";
OBJECTS.logo.set_rgb( 255, 0, 0 );
OBJECTS.logo.charsize = 28;
thanks bro...
Navigation
[0] Message Index
[#] Next page
Go to full version