SPB Git

Repository Public

frames.sh 2.0 KB 40 lines shellscript

1#!/usr/bin/env bash2# Auto-Ka iOS v23# File: Scripts/frames.sh4# Description: planche du geste « monter à bord » figé à plusieurs instants (arguments de lancement, aucun pilotage),5#              à comparer à brand/gesture/planche-mobile.png.6#              usage : frames.sh <préfixe> <clair|sombre> [signature|courte|verdict]   (TIMES="140 340 …", AUTOKA_SIM)7#8# Author: Simon-Pierre Boucher9# Contact: contact@spboucher.ai10set -uo pipefail11cd "$(dirname "$0")/.."12P="${1:-geste}"; MODE="${2:-clair}"; LEVEL="${3:-signature}"13SIM="${AUTOKA_SIM:-AutoKa v2 iPhone}"14U="$(xcrun simctl list devices | grep -F "$SIM (" | head -1 | sed -E 's/.*\(([0-9A-F-]{36})\).*/\1/')"15xcrun simctl boot "$U" 2>/dev/null; xcrun simctl bootstatus "$U" >/dev/null 2>&116APP="$([ "$MODE" = clair ] && echo light || echo dark)"17xcrun simctl ui "$U" appearance "$APP"18FILES=()19for T in ${TIMES:-0 140 340 500 700 900 1100 1300 1500 1900}; do20  AUTOKA_SIM="$SIM" Scripts/build.sh run -AKInMemory YES -AKBoardDemo YES -AKBoardT "$T" -AKBoardLevel "$LEVEL" -AKBoardDelay 2.5 -appearance "$APP" >/dev/null 2>&121  sleep "${WAIT:-9}"22  xcrun simctl io "$U" screenshot "build/shots/$P-$T.png" >/dev/null 2>&123  FILES+=("build/shots/$P-$T.png")24done25python3 - "$P" "${FILES[@]}" <<'PY'26import sys27from PIL import Image, ImageDraw28p, files = sys.argv[1], sys.argv[2:]29ims = [Image.open(f).convert("RGB") for f in files]30w = 360; ims = [i.resize((w, int(i.height * w / i.width))) for i in ims]31cols = 5; rows = (len(ims) + cols - 1) // cols; h = ims[0].height32sheet = Image.new("RGB", (cols * (w + 8) + 8, rows * (h + 8) + 8), (128, 128, 128))33for k, im in enumerate(ims):34    x, y = 8 + (k % cols) * (w + 8), 8 + (k // cols) * (h + 8)35    sheet.paste(im, (x, y))36    d = ImageDraw.Draw(sheet); t = files[k].rsplit("-", 1)[1].replace(".png", " ms")37    d.rectangle([x, y, x + 78, y + 20], fill=(0, 0, 0)); d.text((x + 6, y + 4), t, fill=(255, 255, 255))38sheet.save(f"build/shots/{p}-planche.png"); print(f"build/shots/{p}-planche.png")39PY40
Files main
Menu

Theme