Skip to content

サイトのティーザー動画を台本から作れるようにする - #132

Merged
temoki merged 1 commit into
mainfrom
video/teaser
Sep 26, 2026
Merged

temoki merged 1 commit into
mainfrom
video/teaser

Conversation

@temoki

@temoki temoki commented Sep 26, 2026

Copy link
Copy Markdown
Owner

サイトに載せている紹介動画(iPad を手で操作した画面収録)の後継を、台本から作れるようにしました。ruby Tools/teaser/teaser.rb を実行すると、iPad のシミュレータで操作を再現して録画し、音なし・約 2 分・1080p の動画に仕上げます。アプリが変わっても、同じ動画を何度でも撮り直せます。

音楽はあとから手作業で入れる前提です。動画ファイルそのものはリポジトリに入れていません。YouTube にアップロードしたら、サイトの埋め込みを差し替える予定です(別 PR)。

動画の中身

ブロックを組んで、試しながら直していく流れです。字幕は英語です。

字幕 場面
Tap a block. / Press play. / Try, look, change. 線を 1 本引き、曲げる
Again and again? / Repeat it. 手で並べて四角 → くり返しブロックにまとめる
What if we turn 120°? / Not quite… 144! 角度を変えて三角 → 星
Add some color. ペンの色と太さをドラッグで足す
Let the line grow. 箱(変数)で線が伸びる星のうずまき
It's real Swift. コードの画面

最初と最後にアイコンとアプリ名を出し、最後には対応機種も出します。画面は上下に少し余白を取って角を丸め、操作している場所へズームします。

仕組み

  • 台本:TortoiseBlocksUITests/TeaserTests.swift
    • 押す場所、字幕を出すタイミング、カメラの向き先を、この順に書いてあります。
    • 何をいつどこで押したかをログに残します。
  • 編集:Tools/teaser/teaser.rb
    • 録画とログから、止まっている時間を詰めます。シミュレータは画面が変わったときだけコマを書くので、コマの間隔がそのまま止まっている時間になります。
    • ズーム、タップの丸、字幕、最初と最後のカードを合成します。
  • 字幕の描画:Tools/teaser/text.swift
    • SF Pro Rounded で描きます。

安定させるためにしたこと

詳しくは Tools/teaser/README.md に書きました。

  • 座標のタップはスクロールしない。 画面外のパレット項目は、指でスクロールしてから押します。最初は画面外の Repeat の代わりに Start Fill が入りました。
  • 数値の入力にはハードウェアキーボードが要る。 つながっていないと、画面の半分がキーボードで埋まります。撮影中だけ Simulator の設定 ConnectHardwareKeyboard をオンにして、終わったら戻します。Xcode 27 には Simulator.app がありません。
  • 入力中のカーソルの点滅もコマになる。 入力中の区間はキーを打った瞬間だけを残します。
  • 描き終わりは「再生バーが動いた」では判定できない。
    • 短い描画は、タップが返る前に終わっていることがあります。
    • 角度だけ変えると、再生バーの最終値が前回と同じになります。
  • シミュレータのドロップは、たまに入らない。 入ったことを確かめ、失敗した分はやり直して動画から切り落とします。

撮影中に気づいたこと(この PR では直していません)

  • iPad 11 インチの横向きで、右上の切り替えが「Canvas」ではなく「Canv…」と省略されます。動画にも映ります。
  • 再生バーの 1 コマ送りボタンの読み上げ名が「Forward」で、パレットのブロックと同じです。VoiceOver では区別がつきません。

確認したこと

  • ruby Tools/teaser/teaser.rb を通しで実行し、124 秒の動画ができること(メンテナが視聴済み)
  • UI テストのビルド(iOS シミュレータ・macOS)、swift format lint --strict
  • 撮影後に Simulator の設定(ConnectHardwareKeyboard)が元に戻ること

The landing page's video was an iPad screen recording made by hand. This
makes its successor from a script instead, so it can be shot again whenever
the app changes: `ruby Tools/teaser/teaser.rb` records a UI test on the
11-inch iPad simulator and cuts it into a silent two-minute 1080p film,
ready for music.

TeaserTests is the script: one line, a corner, a square the long way and
then with a repeat, 120° and 144° until a star turns up, colour, and a box
that grows it into a spiral, ending on the generated Swift. It presses by
coordinates and logs every press, drag, caption and camera move with its
time. teaser.rb is the editor. It cuts the still stretches the simulator
leaves between frames, zooms toward the part of the screen that matters,
draws the touches the simulator does not show, lays the captions on, and
puts the icon on either end.

What it took to make that reliable is in Tools/teaser/README.md:
- Coordinate taps do not scroll, so the palette is scrolled by a finger.
- Number fields need a hardware keyboard.
- Caret blinks would otherwise count as motion.
- "Finished drawing" cannot mean "the scrubber moved".
- A drop that does not land is retried and cut out of the film.
@temoki
temoki merged commit 78ed69b into main Sep 26, 2026
7 checks passed
@temoki
temoki deleted the video/teaser branch September 26, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant