the complete menu: aperitif CRT terminal + courses III node/pod, IV traffic, V orbit - five animation personalities, clip-split and reverse slice modes
This commit is contained in:
+17
-2
@@ -62,6 +62,11 @@ def emit(name, tag, spec):
|
||||
for part in spec["parts"]:
|
||||
xs = np.concatenate([comps[i]["xs"] for i in part["comps"]])
|
||||
ys = np.concatenate([comps[i]["ys"] for i in part["comps"]])
|
||||
if "clip" in part:
|
||||
x0, y0, x1, y1 = part["clip"]
|
||||
W2, H2 = W, lum.shape[0]
|
||||
keep = (xs >= x0*W2) & (xs < x1*W2) & (ys >= y0*H2) & (ys < y1*H2)
|
||||
xs, ys = xs[keep], ys[keep]
|
||||
pts = np.stack([xs, ys], 1).astype(np.float64)
|
||||
hull = ConvexHull(pts)
|
||||
poly = pts[hull.vertices]
|
||||
@@ -77,7 +82,10 @@ def emit(name, tag, spec):
|
||||
z=part.get("z", 0),
|
||||
points=[[round(float(x) / W * 100, 2), round(float(y) / h * 100, 2)] for x, y in poly],
|
||||
cx=round(float(np.mean(xs)) / W * 100, 2), cy=round(float(np.mean(ys)) / h * 100, 2)))
|
||||
ax, ay = next((p["cx"], p["cy"]) for p in parts if p["name"] == spec["anchor"])
|
||||
if "anchor_xy" in spec:
|
||||
ax, ay = spec["anchor_xy"]
|
||||
else:
|
||||
ax, ay = next((p["cx"], p["cy"]) for p in parts if p["name"] == spec["anchor"])
|
||||
for p in parts:
|
||||
nest = spec.get("nest_overrides", {}).get(p["name"], spec.get("nest", 0.72))
|
||||
p["dx"] = round((ax - p["cx"]) * nest, 2)
|
||||
@@ -86,6 +94,8 @@ def emit(name, tag, spec):
|
||||
man = dict(scene=tag, source=f"assets/raw/{name}", parts=parts)
|
||||
if "stagger" in spec:
|
||||
man["stagger"] = spec["stagger"]
|
||||
if spec.get("reverse"):
|
||||
man["reverse"] = True
|
||||
out = ROOT / "pilot" / f"manifest-{tag}.json"
|
||||
out.write_text(json.dumps(man, indent=1))
|
||||
print(f"manifest-{tag}.json: {len(parts)} parts ->",
|
||||
@@ -94,7 +104,12 @@ def emit(name, tag, spec):
|
||||
if __name__ == "__main__":
|
||||
mode, scenes_json, outdir = sys.argv[1], sys.argv[2], sys.argv[3]
|
||||
scenes = json.loads(pathlib.Path(scenes_json).read_text()) if mode == "emit" else None
|
||||
heroes = [("course-II-cluster.jpeg", "cluster"),
|
||||
heroes = [("course-00-surround.jpeg", "surround"),
|
||||
("course-III-node.jpeg", "node"),
|
||||
("course-III-pod.jpeg", "pod"),
|
||||
("course-IV-traffic.jpeg", "traffic"),
|
||||
("course-V-orbit.jpeg", "orbit"),
|
||||
("course-II-cluster.jpeg", "cluster"),
|
||||
("course-VI-gitops.jpeg", "gitops"),
|
||||
("course-VII-supply-chain.jpeg", "supply"),
|
||||
("course-VIII-helm-press.jpeg", "helm")]
|
||||
|
||||
Reference in New Issue
Block a user