Getting Festive | Linux Out Loud 44

This week, Linux Out Loud chats about festive-themed games.

Welcome to episode 44 of Linux Out Loud. We fired up our mics, connected those headphones as we searched the community for themes to expound upon. We kept the banter friendly, the conversation somewhat on topic, and had fun doing it.

00:00:00 Introduction
00:01:49 Game Sphere Unboxing
00:05:14 New Retro Video
00:08:08 PETG
00:18:09 Getting Festive
00:29:29 Game of the Week
00:33:17 5V Lights
00:36:24 Cricut in a Bottle
00:43:35 Close

Main Topic

Matt

Nate

Wendy

Our sponsors:

Contact info
Matt (Twitter @MattTDN)
Wendy (Mastodon @WendyDLN)
Nate (Website CubicleNate.com)

1 Like

How to: Create an animated BASH script to thank Linux Out Loud

# Download a fireplace scene
wget -O bg.webm https://allthatsinteresting.com/wordpress/wp-content/uploads/2015/05/cinemagraph-gifs-fireplace.gif.webm

# Create an overlay.png in krita to the same dimensions (700 x 416)


# Merge the overlay and the fireplace into bg.gif
ffmpeg -i bg.webm -i overlay.png \
	-filter_complex "[0:v][1:v] overlay=0:0'" \
	-pix_fmt yuv420p -c:a copy \
	bg.gif -y

# Split the gif into seperate images
ffmpeg -i bg.gif -vsync 0 frame-%03d.png

# Create a tighter loop by deleting frames
rm 'frame-'{027..070}'.png'

# Use chafa to convert each frame to terminal characters with color escape sequences
# Note: Set the terminal to the width you'd like the output to be.
for File in frame-*.png; do
	chafa "$File" > "$File.sh"
done

# Test a frame using printf to interpret the color sequences onto the terminal.
printf "$(< 'frame-001.png.sh')"

# Load every frame into an array
FrameArr=()
for File in frame-*.png.sh; do
	FrameArr+=("$(<"$File")")
done

# Create our script
printf '%s\n' '#!/usr/bin/env bash' > ./linux-out-loud-xmas

# Serialize the frame array safely into the script so when it executes it'll be recreated.
declare -p FrameArr >> ./linux-out-loud-xmas

# Add some newlines to make it easier to edit
printf '\n\n' >> ./linux-out-loud-xmas

nano ./linux-out-loud-xmas
	# Down arrow to get to the bottom
	# Add the following to the end of the script to perform the animation:
# Clear the screen
clear

# Hide the cursor
tput civis

# Take the first arguement for framespeed or use 0.03
FrameSpeed=${1:-0.03}

FrameArrLen=${#FrameArr[@]}
while true; do
	for (( i = 0; i < FrameArrLen; i++ )); do

		# Place the cursor at position 0 0
		# This prevents flicker because the frames will be overdrawing each other)
		tput cup 0 0

		printf "${FrameArr[$i]}"
		sleep "$FrameSpeed"
	done
done
# Make execurable for your user
chmod u+x ./linux-out-loud-xmas

# Enjoy
./linux-out-loud-xmas

gif

3 Likes

Wendy, Nate and Matt thank you so much for the episodes, have a Merry Christmas and a happy new year! :christmas_tree: :sparkler: :joystick: :keyboard:

2 Likes

I absolutely LOVE it @Ulfnic Merry Christmas and a Happy New Year to you as well. Thanks for being such an awesome listener, community member, and moderator.

2 Likes