Skip to content

Commit

Permalink
Issues #96 and #98 - improved control over timing of image/video loading
Browse files Browse the repository at this point in the history
- Added an EndNavigation transition event
- Added a trigger attribute to Image artworks that lets you specify when
  they are loaded (on each selection or at the end of navigation)
- Updated the basic layout to load snap and marquee at end of navigation
- Updated orbit layout, including by adding a static effect when
  navigating
  • Loading branch information
mickelson committed Jan 25, 2015
1 parent d0b09eb commit b6d3245
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 53 deletions.
10 changes: 9 additions & 1 deletion Layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ happening. It will have one of the following values:
* `Transition.ToGame`
* `Transition.FromGame`
* `Transition.ToNewList`
* `Transition.EndNavigation`

The value of the `var` parameter passed to the transition function depends
upon the value of `ttype`:
Expand Down Expand Up @@ -473,8 +474,12 @@ upon the value of `ttype`:
screen saver is starting, or
- `FromTo.NoValue` otherwise.

* When `ttype` is `Transition.ToNewList`, `var` indicates the filter index
offset of the filter being transitioned to (i.e. -1 when moving back one
filter, 1 when moving forward) if known, otherwise `var` is 0.

* When `ttype` is `Transition.ToGame`, `Transition.FromGame`, or
`Transition.ToNewList`, `var` will be `FromTo.NoValue`.
`Transition.EndNavigation`, `var` will be `FromTo.NoValue`.

The `transition_time` parameter passed to the transition function is the
amount of time (in milliseconds) since the transition began.
Expand Down Expand Up @@ -1099,6 +1104,9 @@ Attributes:
get reset the next time the user changes the game selection.
* `shader` - Get/set the GLSL shader for this image. This can only be set to
an instance of the class `fe.Shader` (see: `fe.add_shader()`).
* trigger - Get/set the transition that triggers updates of this artwork.
Can be set to `Transition.ToNewSelection` or `Transition.EndNavigation`.
Default value is `Transition.ToNewSelection`.

Member Functions:

Expand Down
7 changes: 5 additions & 2 deletions config/layouts/basic/layout.nut
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
fe.layout.width=640;
fe.layout.height=480;

fe.add_artwork( "snap", 348, 152, 262, 262 );
fe.add_artwork( "marquee", 348, 64, 262, 72 );
local t = fe.add_artwork( "snap", 348, 152, 262, 262 );
t.trigger = Transition.EndNavigation;

t = fe.add_artwork( "marquee", 348, 64, 262, 72 );
t.trigger = Transition.EndNavigation;

local l = fe.add_listbox( 32, 64, 262, 352 );
l.charsize = 16;
Expand Down
4 changes: 4 additions & 0 deletions config/layouts/filter-grid/layout.nut
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class UserConfig {

</ label="Flow Direction", help="Select the flow direction for entries", options="Horizontal,Vertical", order=4 />
flow="Vertical";

</ label="Preserve Aspect Ratio", help="Preserve artwork aspect ratio", options="Yes,No", order=5 />
aspect_ratio="Yes";
}

fe.layout.width = 800;
Expand Down Expand Up @@ -88,6 +91,7 @@ for ( local i=0; i<ftr_count; i++ )
}
new_strip.set_selection( 0 );
new_strip.video_flags = Vid.NoAudio;
new_strip.preserve_aspect_ratio = (my_config["aspect_ratio"]=="Yes");

local temp = i - ftr_index;
if ( temp != 0 )
Expand Down
76 changes: 71 additions & 5 deletions config/layouts/orbit/layout.nut
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
// Attract-Mode Frontend - Orbit layout
//
///////////////////////////////////////////////////
//
// NOTES:
//
// - The looping static video is from the rec room website at:
// http://recroomhq.com/downloads/2010/04/14/tv-static-freebie.html
// It is licensed under the Creative Commons Attribution 3.0 License
//
///////////////////////////////////////////////////
class UserConfig {
</ label="Orbit Artwork", help="The artwork to spin into orbit", options="marquee,flyer,wheel", order=1 />
orbit_art="marquee";
Expand All @@ -15,6 +23,12 @@ class UserConfig {

</ label="Satellite Count", help="The number of orbiting artworks", options="5,7,9,11,13,15", order=4 />
count="5";

</ label="Spin Time", help="The amount of time it takes to spin to the next selection (in milliseconds)", order=5 />
spin_ms="120";

</ label="Static Effect", help="Enable static effect", options="Yes,No", order=6 />
static_effect="Yes";
}

fe.load_module( "conveyor" );
Expand All @@ -25,11 +39,16 @@ fe.layout.height = 600

const MWIDTH = 280;
const MHEIGHT = 170;
const SPIN_MS = 200;
const SNAPBG_ALPHA = 200;

local num_sats = fe.layout.page_size = my_config["count"].tointeger();
local progress_correction = 1.0 / ( num_sats * 2 );

local spin_ms = 120;
try {
spin_ms = my_config["spin_ms"].tointeger();
} catch ( e ) {}

function get_y( x )
{
// 270^2 = 72900
Expand Down Expand Up @@ -111,9 +130,26 @@ if ( my_config[ "bg_image" ].len() > 0 )
//
// Initialize the video frame
//
local snapbg = fe.add_text( "", 224, 59, 352, 264 );
snapbg.bg_alpha = 220;
fe.add_artwork( "snap", 224, 59, 352, 264 );
local snapbg=null;
if ( my_config[ "static_effect" ] == "Yes" )
{
snapbg = fe.add_image(
"static.mp4",
224, 59, 352, 264 );

snapbg.set_rgb( 150, 150, 150 );
snapbg.alpha = SNAPBG_ALPHA;
}
else
{
local temp = fe.add_text(
"",
224, 59, 352, 264 );
temp.bg_alpha = SNAPBG_ALPHA;
}

local snap = fe.add_artwork( "snap", 224, 59, 352, 264 );
snap.trigger = Transition.EndNavigation;
local frame = fe.add_image( "frame.png", 216, 51, 368, 278 );

//
Expand Down Expand Up @@ -142,7 +178,7 @@ for ( local i=0; i < ( num_sats + 1 ) / 2; i++ )
// Initialize a conveyor to control the artworks
//
local orbital = Conveyor();
orbital.transition_ms = SPIN_MS;
orbital.transition_ms = spin_ms;
orbital.transition_swap_point = 1.0;
orbital.set_slots( sats );

Expand Down Expand Up @@ -207,6 +243,34 @@ function orbit_transition( ttype, var, ttime )
{
switch ( ttype )
{
case Transition.ToNewSelection:
if ( snapbg )
{
if ( snap.file_name.len() > 0 )
{
if ( ttime < spin_ms )
{
snap.alpha = 255 - 255.0 * ttime / spin_ms;
return true;
}
}
snap.file_name="";
snap.alpha=0;
}
break;

case Transition.EndNavigation:
if ( snapbg )
{
if ( ttime < spin_ms )
{
snap.alpha = 255.0 * ttime / spin_ms;
return true;
}
snap.alpha = 255;
}
break;

case Transition.StartLayout:
case Transition.FromGame:
if ( ttime < 255 )
Expand All @@ -221,6 +285,8 @@ function orbit_transition( ttype, var, ttime )
foreach (o in fe.obj)
o.alpha = 255;
}
if ( snapbg )
snapbg.alpha=SNAPBG_ALPHA;
break;

case Transition.EndLayout:
Expand Down
Binary file added config/layouts/orbit/static.mp4
Binary file not shown.
Loading

0 comments on commit b6d3245

Please sign in to comment.