Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,21 @@ These are presentation compositions of the original catalogue SVGs, with unused

The installed skill does not depend on the website. These paths are relative to the repository root.

| Responsibility | Source |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Gallery SVG wrapper and role-style opt-in | `components/plotter/blueprint-drawing.tsx` |
| Catalogue compiler and SVG serializer | `scripts/build-plotter-drawings.py`, `scripts/plotter_svg.py` |
| Bundled catalogue SVGs and index | `skills/plotter/references/catalogue/`, generated by `scripts/build-plotter-catalogue.tsx` |
| AGT-01 helper-fragment recipe | `skills/plotter/assets/examples/render-registration.mjs` |
| AGT-01 host file adapter | `scripts/build-plotter-registration.mjs` |
| Static MEC-05 and OBJ-05 | `components/plotter/engineering-studies.tsx` |
| MEC-05 shared core hatching | `components/plotter/production-chain-hatching.tsx` |
| MEC-05 and OBJ-05 timelines | `components/plotter/production-chain-motion-drawing.tsx`, `components/plotter/newtons-cradle-motion-drawing.tsx` |
| Geneva and crank/piston stills and timelines | `components/plotter/geneva-mechanism-motion-drawing.tsx`, `components/plotter/crank-piston-motion-drawing.tsx` |
| Engineering playback, fallback, and visibility | `components/plotter/engineering-motion-preview.tsx` |
| Resolved pilot export adapter | `scripts/export-plotter-pilots.tsx` |
| Download artifact generator | `scripts/build-plotter-downloads.tsx` |
| Responsibility | Source |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Gallery SVG wrapper and role-style opt-in | `components/plotter/blueprint-drawing.tsx` |
| Catalogue compiler and SVG serializer | `scripts/build-plotter-drawings.py`, `scripts/plotter_svg.py` |
| Bundled catalogue SVGs and index | `skills/plotter/references/catalogue/`, generated by `scripts/build-plotter-catalogue.tsx` |
| AGT-01 helper-fragment recipe | `skills/plotter/assets/examples/render-registration.mjs` |
| AGT-01 host file adapter | `scripts/build-plotter-registration.mjs` |
| Static MEC-05 and OBJ-05 | `components/plotter/engineering-studies.tsx` |
| MEC-05 shared core hatching | `components/plotter/production-chain-hatching.tsx` |
| MEC-05 and OBJ-05 timelines | `components/plotter/production-chain-motion-drawing.tsx`, `components/plotter/newtons-cradle-motion-drawing.tsx` |
| Geneva and crank/piston stills and timelines | `components/plotter/geneva-mechanism-motion-drawing.tsx`, `components/plotter/crank-piston-motion-drawing.tsx` |
| Slotted lever source and gallery adapter | `examples/slotted-lever/`, `scripts/build-plotter-slotted-lever.py`, `components/plotter/slotted-lever-motion.tsx` |
| Engineering playback, fallback, and visibility | `components/plotter/engineering-motion-preview.tsx` |
| Resolved pilot export adapter | `scripts/export-plotter-pilots.tsx` |
| Download artifact generator | `scripts/build-plotter-downloads.tsx` |

`BlueprintDrawing` opts into shared roles with `roles`. The independent highlight-opacity token is used by TIM-01, TIM-03, and TIM-05 without changing their stroke-role adoption. The SVG-to-JSX builder preserves supported root styles, removes standalone fixed ink and the root font family so the gallery inherits its theme and loaded font, and gives repeated definitions local IDs. Font weight, optical sizing, and GEOM settings remain authored. Standalone SVGs retain their own font stack.

Expand Down
13 changes: 13 additions & 0 deletions app/animations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { ParticlesMotion } from "@/components/plotter/particles-motion";
import { PrimitivesBlueprint } from "@/components/plotter/primitives-blueprint";
import { PrimitivesMotionPreview } from "@/components/plotter/primitives-motion-preview";
import { ProductionChainMotionDrawing } from "@/components/plotter/production-chain-motion-drawing";
import { SlottedLeverDrawing } from "@/components/plotter/slotted-lever-drawing";
import { PageIntro, SheetBar } from "@/components/sheet";
import { SiteShell } from "@/components/site-shell";

Expand Down Expand Up @@ -145,6 +146,18 @@ const studies: {
</EngineeringMotionPreview>
),
},
{
id: "slotted-lever-animation",
label: "Motion only",
title: "A rotation becomes a return",
description:
"A rotating crank slides a pin through a rocking lever. A short link carries that motion to a carriage, turning each revolution into a journey out and back.",
preview: (
<EngineeringMotionPreview animated={<SlottedLeverDrawing animated />}>
<SlottedLeverDrawing />
</EngineeringMotionPreview>
),
},
];

export const metadata: Metadata = { title: "Animations" };
Expand Down
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"!public",
"!skills/plotter/references/catalogue",
"!components/plotter/expanded-studies.tsx",
"!components/plotter/slotted-lever-drawing.tsx",
"!components/plotter/visual-grammar-drawings.tsx",
"!skills/plotter/assets/foundation/roles.css",
"!skills/plotter/assets/foundation/standard.mjs",
Expand Down
121 changes: 121 additions & 0 deletions components/plotter/slotted-lever-drawing.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Generated by scripts/build-plotter-slotted-lever.py from the standalone SVG.
// Edit examples/slotted-lever/drawing.mjs, rebuild its SVG, then regenerate.
import { useId } from "react";
import { BlueprintDrawing } from "./blueprint-drawing";
import { SlottedLeverMotion } from "./slotted-lever-motion";

export function SlottedLeverDrawing({ animated = false }: { animated?: boolean }) {
const id = useId();
return (
<BlueprintDrawing roles>
<g strokeLinecap="butt" strokeLinejoin="round" fontWeight="400">



<defs>
<mask id={`${id}-sl-joints`} maskUnits={"userSpaceOnUse"} x={"0"} y={"0"} width={"560"} height={"440"}>
<rect width={"560"} height={"440"} fill={"white"} stroke={"none"} />
<g fill={"black"} stroke={"none"}>
<circle cx={"250"} cy={"254"} r={"11"} />
<circle cx={"250"} cy={"358"} r={"8"} />
<circle id={`${id}-sl-pin-clear`} cx={"305.160753"} cy={"297.096303"} r={"7"}>
<SlottedLeverMotion animated={animated} property={"pinX"} attributeName={"cx"} />
<SlottedLeverMotion animated={animated} property={"pinY"} attributeName={"cy"} />
</circle>
<circle id={`${id}-sl-tip-clear`} cx={"432.592894"} cy={"156.396837"} r={"6"}>
<SlottedLeverMotion animated={animated} property={"tipX"} attributeName={"cx"} />
<SlottedLeverMotion animated={animated} property={"tipY"} attributeName={"cy"} />
</circle>
<circle id={`${id}-sl-carriage-clear`} cx={"470.596647"} cy={"86"} r={"7"}>
<SlottedLeverMotion animated={animated} property={"carriageX"} attributeName={"cx"} />
</circle>
</g>
</mask>
<mask id={`${id}-sl-hatch-clear`} maskUnits={"userSpaceOnUse"} x={"-32"} y={"-18"} width={"64"} height={"36"}>
<rect x={"-32"} y={"-18"} width={"64"} height={"36"} fill={"white"} stroke={"none"} />
<circle r={"8"} fill={"black"} stroke={"none"} />
</mask>
</defs>
<g data-plotter-role={"secondary"}>
<path d={"M64 58H510M64 114H510"} />
<circle cx={"250"} cy={"254"} r={"78"} />
</g>
<g data-plotter-role={"centerline"} mask={`url(#${id}-sl-joints)`}>
<circle cx={"250"} cy={"254"} r={"70"} />
<path d={"M262 254H346M250 158V374"} />
</g>
<g mask={`url(#${id}-sl-joints)`}>
<g id={`${id}-sl-wheel`} transform={"rotate(38 250 254)"}>
<g transform={"translate(250 254)"}>
<rect x={"0"} y={"-4"} width={"70"} height={"8"} rx={"4"} data-plotter-role={"primary"} />
<g data-plotter-role={"secondary"}>
<rect x={"0"} y={"-4"} width={"70"} height={"8"} rx={"4"} transform={"rotate(120)"} />
<rect x={"0"} y={"-4"} width={"70"} height={"8"} rx={"4"} transform={"rotate(240)"} />
</g>
</g>
<SlottedLeverMotion animated={animated} property={"crank"} attributeName={"transform"} type={"rotate"} />
</g>
<g transform={"translate(250 358)"}>
<g id={`${id}-sl-lever`} transform={"rotate(42.167278)"}>
<rect x={"-7"} y={"-279"} width={"14"} height={"286"} rx={"7"} data-plotter-role={"primary"} />
<rect x={"-3"} y={"-250"} width={"6"} height={"228"} rx={"3"} data-plotter-role={"secondary"} />
<SlottedLeverMotion animated={animated} property={"lever"} attributeName={"transform"} type={"rotate"} />
</g>
</g>
<g id={`${id}-sl-link`} transform={"translate(432.592894 156.396837)"} data-plotter-role={"primary"}>
<g transform={"rotate(-61.637595)"}>
<rect x={"0"} y={"-4"} width={"80"} height={"8"} rx={"4"} />
<SlottedLeverMotion animated={animated} property={"linkRotation"} attributeName={"transform"} type={"rotate"} />
</g>
<SlottedLeverMotion animated={animated} property={"linkPosition"} attributeName={"transform"} type={"translate"} />
</g>
</g>
<g id={`${id}-sl-carriage`} transform={"translate(470.596647 86)"}>
<path d={"M-32 -6L-20 -18 M-32 6L-8 -18 M-32 18L4 -18 M-20 18L16 -18 M-8 18L28 -18 M4 18L32 -10 M16 18L32 2 M28 18L32 14"} data-plotter-role={"hatch"} mask={`url(#${id}-sl-hatch-clear)`} />
<rect x={"-32"} y={"-18"} width={"64"} height={"36"} data-plotter-role={"primary"} />
<circle r={"5"} data-plotter-role={"primary"} />
<SlottedLeverMotion animated={animated} property={"carriage"} attributeName={"transform"} type={"translate"} />
</g>
<g data-plotter-role={"primary"}>
<circle id={`${id}-sl-pin`} cx={"305.160753"} cy={"297.096303"} r={"5"}>
<SlottedLeverMotion animated={animated} property={"pinX"} attributeName={"cx"} />
<SlottedLeverMotion animated={animated} property={"pinY"} attributeName={"cy"} />
</circle>
<circle id={`${id}-sl-tip`} cx={"432.592894"} cy={"156.396837"} r={"4"}>
<SlottedLeverMotion animated={animated} property={"tipX"} attributeName={"cx"} />
<SlottedLeverMotion animated={animated} property={"tipY"} attributeName={"cy"} />
</circle>
<circle cx={"250"} cy={"254"} r={"9"} />
<circle cx={"250"} cy={"358"} r={"6"} />
<path d={"M214 374H286"} />
</g>
<g data-plotter-role={"secondary"}>
<circle cx={"250"} cy={"254"} r={"2.5"} />
<path d={"M247 365L240 374M253 365L260 374"} />
</g>
<g data-plotter-role={"guide"}>
<path d={"M238 254L126 254 M238 358L126 358"} />
</g>
<g data-plotter-role={"dimension"}>
<path d={"M134 254L134 296 M134 316L134 358 M130 258L138 250 M130 362L138 354"} />
</g>
<g data-plotter-role={"leader"}>
<path d={"M92 44V58M258 358H292L304 378"} />
</g>
<g fill={"currentColor"} stroke={"none"} fontSize={"11"} opacity={"0.72"}>
<text x={"74"} y={"36"}>
{"Linear guide"}
</text>
<text x={"310"} y={"384"}>
{"Fixed pivot"}
</text>
</g>
<g fill={"currentColor"} stroke={"none"} fontSize={"10"} opacity={"0.5"}>
<text x={"134"} y={"309"} textAnchor={"middle"}>
{"104"}
</text>
</g>
</g>
</BlueprintDrawing>
);
}
61 changes: 61 additions & 0 deletions components/plotter/slotted-lever-motion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
geometry,
poseAt,
timeline,
} from "../../examples/slotted-lever/geometry.mjs";

const steps = timeline.period * 120;
const number = (value: number) => Number(value.toFixed(6));
const point = ({ x, y }: { x: number; y: number }) =>
`${number(x)} ${number(y)}`;
const frames = Array.from({ length: steps + 1 }, (_, index) => {
const pose = poseAt((index / steps) * timeline.period);
return {
crank: `${number(pose.crankAngle)} ${point(geometry.center)}`,
lever: number(pose.leverAngle),
linkPosition: point(pose.tip),
linkRotation: number(pose.linkAngle),
carriage: point(pose.carriage),
pinX: number(pose.pin.x),
pinY: number(pose.pin.y),
tipX: number(pose.tip.x),
tipY: number(pose.tip.y),
carriageX: number(pose.carriage.x),
};
});
type MotionProperty = keyof (typeof frames)[number];
const values = Object.fromEntries(
Object.keys(frames[0]).map((property) => [
property,
frames.map((frame) => frame[property as MotionProperty]).join(";"),
]),
);

// Sample the standalone equations, retaining the site's native SVG clock.
// Equal intervals and linear interpolation preserve the constant-speed input.
export function SlottedLeverMotion({
animated,
property,
attributeName,
type,
}: {
animated: boolean;
property: MotionProperty;
attributeName: string;
type?: "rotate" | "translate";
}) {
if (!animated) return null;
const props = {
attributeName,
begin: "0s",
dur: `${timeline.period}s`,
calcMode: "linear" as const,
repeatCount: "indefinite",
values: values[property],
};
return type ? (
<animateTransform {...props} type={type} />
) : (
<animate {...props} />
);
}
47 changes: 47 additions & 0 deletions examples/slotted-lever/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A rotation becomes a return

A standalone Plotter adaptation of the supplied `Untitled.mov`. Open
`slotted-lever.html` directly; it contains the drawing, timeline, player, shared
role stylesheet, and Cal Sans font. No server or website build is needed.

The rotating crank pin stays on a circular locus and inside the rocking lever’s
slot. A fixed-length connecting link drives a carriage along horizontal rails.
Hatching identifies the output carriage. This is an ideal geometric construction,
not a manufacturing or dynamics model.

The composition borrows the shared center and generating locus from **Circle,
square, line**, and the constrained output relationship from **An offset becomes
a lift**. It retains the supplied clip’s linkage and three-spoke wheel, with a
six-second constant-speed crank revolution. The return emerges from the linkage;
there are no holds, easing effects, or resets at the cycle boundary.

- `geometry.mjs`: dimensions and pose calculation, independent of playback.
- `drawing.mjs`: editable SVG construction using the canonical Plotter foundation.
- `player.js`: clock, controls, visibility suspension, and reduced-motion fallback.
- `build.mjs`: self-contained HTML and themeable SVG generation.
- `slotted-lever.svg`: editable themeable source, with embedded role CSS.
- `slotted-lever-export.svg`: resolved static export with embedded Cal Sans.
- `slotted-lever-light.png` and `slotted-lever-dark.png`: still previews.

Rebuild from the repository root:

```sh
node examples/slotted-lever/build.mjs
python3 skills/plotter/scripts/check.py examples/slotted-lever/slotted-lever.svg
python3 skills/plotter/scripts/export-svg.py examples/slotted-lever/slotted-lever.svg examples/slotted-lever/slotted-lever-export.svg --embed-font
python3 skills/plotter/scripts/render.py examples/slotted-lever/slotted-lever.svg --theme both
```

Inspected the selected still in light and dark at 560 × 440, three additional
quarter-cycle poses, and the HTML at desktop and narrow widths. The SVG checker
and source lint pass. Headless Chromium interaction checks passed for animation,
pause/resume, replay, still selection, scrubbing, and changing reduced-motion
preferences. Source review covers off-screen/document visibility suspension.
A 60,001-pose sweep found a maximum connecting-link length residual of
4.3 × 10⁻¹⁴ units; the carriage stays inside the rails and the crank pin inside
the slot. Full-cycle normal-speed rhythm has not been visually reviewed.

The website includes this study at `/animations#slotted-lever-animation`. Its
generated React drawing comes from the standalone SVG, while the native SVG
timeline samples the same `geometry.mjs`. Run `bun run drawings` to regenerate
both outputs. The gallery uses the shared playback wrapper without controls.
Loading
Loading