#!/bin/sh
# Le slide del carosello, in PNG: Google Play 1080x1920, App Store (6,9") 1320x2868.
cd "$(dirname "$0")"
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
for p in android:1080,1920 ios:1320,2868; do
  nome=${p%%:*}; mkdir -p "$nome"
  for s in 1 2 3 4 5 6; do
    "$CHROME" --headless --disable-gpu --hide-scrollbars --allow-file-access-from-files \
      --virtual-time-budget=8000 --window-size=${p#*:} \
      --screenshot="$PWD/$nome/$s.png" "file://$PWD/slide.html?s=$s&p=$nome" 2>/dev/null
  done
done
# Tablet (7" e 10" di Google Play), orizzontali 16:9.
mkdir -p tablet
for s in 1 2 3 4 5; do
  "$CHROME" --headless --disable-gpu --hide-scrollbars --allow-file-access-from-files \
    --virtual-time-budget=8000 --window-size=2560,1440 \
    --screenshot="$PWD/tablet/$s.png" "file://$PWD/slide-tablet.html?s=$s" 2>/dev/null
done
