"""Synthetic dusk scene for the App Store screenshots. Writes SVGs (rendered to PNG by make_screenshots.mjs) in the app's strip geometry — 3072×1024 px, azimuth 0…360 left to right, altitude +90…−30 top to bottom — plus the exact horizon profile of the scene. python3 store/scene.py """ import json import math import sys from pathlib import Path W, H = 3072, 1024 TOP, BOTTOM = 90.0, -30.0 PHOTO_TOP, PHOTO_BOTTOM = 44.0, -22.0 # what 24 frames at +10° tilt cover def X(az): return az / 360 * W def Y(alt): return (TOP - alt) / (TOP - BOTTOM) * H def bump(az, c, w, h): d = (az - c + 540) % 360 - 180 return h * math.exp(-(d / w) ** 2) def fir(az, c, w, h): """Fir tree: triangle with three branch tiers.""" d = abs((az - c + 540) % 360 - 180) if d > w: return -90 t = 1 - d / w tier = 0.18 * h * (1 - ((t * 3) % 1)) return h * t - tier + 2 def alt_at(az): a = 3.2 + 1.4 * math.sin(math.radians(az) * 3) + 0.8 * math.sin(math.radians(az) * 7 + 1) a += 0.35 * math.sin(az * 2.3) + 0.25 * math.sin(az * 5.7) # grass / shrubs # house (roof peak at 49°, chimney at 54°) if 38 <= az <= 60: roof = 15 - abs(az - 49) * (6 / 11) a = max(a, 9, roof) if 53 <= az <= 55: a = max(a, 16.5) # deciduous trees canopy = max(bump(az, 112, 9, 26), bump(az, 100, 6, 21), bump(az, 127, 6, 18), bump(az, 138, 4, 13)) if canopy > 4: canopy += 0.9 * math.sin(az * 11) + 0.6 * math.sin(az * 23) a = max(a, canopy) # fir trees for c, w, h in ((205, 5, 22), (214, 4, 17), (224, 6, 25), (232, 3.5, 15)): a = max(a, fir(az, c, w, h)) # distant tree line and a poplar if 280 <= az <= 330: a = max(a, 8.5 + 1.5 * math.sin(az * 0.9) + 0.8 * math.sin(az * 4.1)) a = max(a, bump(az, 346, 1.4, 20)) return a def silhouette_path(az_max=360.0): pts = [] n = int(az_max * 10) for i in range(n + 1): az = i / 10 pts.append(f'{X(az):.1f},{Y(alt_at(az)):.1f}') return f'M0,{Y(PHOTO_BOTTOM):.1f} L' + ' L'.join(pts) + f' L{X(az_max):.1f},{Y(PHOTO_BOTTOM):.1f} Z' def scene_svg(az_max=360.0, view=None, size=(W, H)): vb = view or (0, 0, W, H) band = f'' house = (f'' f'') return f''' {band} {house} ''' def main(): out = Path(sys.argv[1]) out.mkdir(parents=True, exist_ok=True) (out / 'strip_full.svg').write_text(scene_svg()) (out / 'strip_partial.svg').write_text(scene_svg(az_max=210)) # Portrait camera frame: 39° × 64°, centred on azimuth 205°, altitude +10°. hfov, vfov, az0, alt0 = 39.0, 64.0, 205.0, 10.0 view = (X(az0 - hfov / 2), Y(alt0 + vfov / 2), X(hfov), Y(alt0 - vfov / 2) - Y(alt0 + vfov / 2)) (out / 'camera.svg').write_text(scene_svg(view=view, size=(1080, 1920))) # Exact profile, as the app derives it: highest edge within ±0.5° per degree. profile = [round(max(alt_at(d + k / 10) for k in range(-5, 6)), 2) for d in range(360)] (out / 'profile.json').write_text(json.dumps(profile)) print('scene written to', out, '| max altitude', max(profile)) if __name__ == '__main__': main()