我昨天在WeAreDevelopers World Congress North America做了闭幕主题演讲。作为一个 STAR 时刻我决定融入对破纪录的kākāpō 繁殖季的引用,那是我们在 2026 年经历的。
对于我的闭幕幻灯片,我想庆祝一下,而且我看到一些关于 Claude Opus 5.5 在制作像素艺术动画方面有多出色的讨论。于是我从 Google 图片搜索中收集了三张 Kakapo 照片,并把它们放进 Claude,用了这个提示词:
Here are some photos of kakapo parrots just to remind you what they look like
I need you to make an animation in animated pixel art on HTML 5 canvas of obviously pixel art kakapo jumping up and down having a party with confetti and suchlike - there should be at least 20 of them
我想把它嵌入到 Keynote 演示文稿文件中,所以我下载了 HTML,并告诉一个本地的 Claude Code 会话:
Make me a video of file:///Users/simon/Downloads/kakapo-party.html - you need to load it in a browser and click on it a few times to get the confetti effect, the video should be 15s long
don't start clicking until 3s in
make sure several clicks are spread around the clickable area
Claude Code 使用了 Playwright(文字记录在这里)并制作了这个视频,这正是我最后一张幻灯片所需要的:
这是它使用的完整 Playwright 脚本,短得令人愉快:
# /// script # dependencies = ["playwright"] # /// import time from playwright.sync_api import sync_playwright W, H = 1280, 720 # 画布填满视口;将点击分散到角落、边缘和中心 clicks = [ (3.0, 640, 360), # 中心 (4.2, 160, 120), # 左上 (5.4, 1120, 120), # 右上 (6.6, 180, 600), # 左下 (7.8, 1100, 600), # 右下 (9.0, 640, 100), # 顶部中心 (10.0, 380, 380), # 中左 (11.0, 900, 380), # 中右 (12.2, 640, 620), # 底部中心 (13.2, 640, 300), # 终场中心 ] with sync_playwright() as p: b = p.chromium.launch() ctx = b.new_context(viewport={"width":W,"height":H}, record_video_dir="vids", record_video_size={"width":W,"height":H}) page = ctx.new_page() t0 = time.time() page.goto("file:///Users/simon/Downloads/kakapo-party.html") for t,x,y in clicks: time.sleep(max(0, t-(time.time()-t0))) page.mouse.click(x,y) time.sleep(max(0, 16.0-(time.time()-t0))) ctx.close(); b.close()