Author Topic: Alignment of Videos?  (Read 83 times)

YellowBirdAZ

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Alignment of Videos?
« on: June 01, 2017, 06:59:07 AM »
What is the best way to center snap videos on screen in AM? (Even if it's just horizontally.)

I searched and didn't find anything on this, probably because the answer is so obvious no one posts about it.

I have a layout where the snap videos are anchored at the upper left corner (0,0), but since they all differ in size it looks cruddy as you browse games. Likewise, scaling the videos to fill the screen doesn't look great. I guess I could ffmpeg my snap videos so they are in pillarboxes to at least make them all the same width as the layout, but this isn't the best either.

I'd prefer to just be able to center the video in the layout.

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
    • View Profile
Re: Alignment of Videos?
« Reply #1 on: June 01, 2017, 03:17:28 PM »
If you just want the video aspect preserved, just do:
Code: [Select]
local vid = fe.add_artwork("snap", 0, 0, fe.layout.width, fe.layout.height)
vid.preserve_aspect_ratio = true
preserve_aspect_ratio property will center and fit the video in your specified dimensions.

If you are trying to do a 'fill' effect, so the video fills your dimensions, you might want to check out my preserve_art module:

https://github.com/liquid8d/attract-extra/blob/master/modules/preserve-art.nut

Code: [Select]
fe.load_module("preserve-art")
//....
//....
local art = PreserveArt( "snap", 0, 0, fe.layout.width, fe.layout.height )
art.set_fit_or_fill( "fill" )  // fit, fill or stretch
art.set_anchor( ::Anchor.Bottom ) // Top, Left, Center, Centre, Right, Bottom

YellowBirdAZ

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Alignment of Videos?
« Reply #2 on: June 02, 2017, 12:22:14 AM »
Thanks!

I will check out the preserve_art module, but for now preserve_aspect_ratio did the trick. It looks just the way I imagined it should.