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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Release metadata and the original showcase live in `src/data/site.ts`:

[All features](https://animathio.com/examples#all-features) uses editable source
projects from [the main repository](https://github.com/AniMathIO/AniMathIO/tree/main/examples/feature-gallery).
Render the complete gallery with its release CLI and enabled Code Snippets
bundle, then copy the outputs into this checkout:
Render the complete gallery with its release CLI and all community bundles
listed in the source gallery README enabled, then copy the outputs into this checkout:

```bash
cp /path/to/feature-gallery/manifest.json src/data/feature-gallery.json
Expand All @@ -41,4 +41,3 @@ cp /path/to/feature-gallery/img/*.webp public/img/gallery/
```

Each card loads its video on play. Keep the gallery media under 40 MB.
Upcoming community plugins are listed in `src/components/FeatureGallery.tsx`.
Binary file added public/img/gallery/molecule-caffeine.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/molecule-esterification.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/network-arp.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/network-dns.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/optics-lens.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/optics-tir.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/physics-dominoes.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/gallery/physics-projectile.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/videos/gallery/molecule-caffeine.mp4
Binary file not shown.
Binary file added public/videos/gallery/molecule-caffeine.webm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/videos/gallery/network-arp.mp4
Binary file not shown.
Binary file added public/videos/gallery/network-arp.webm
Binary file not shown.
Binary file added public/videos/gallery/network-dns.mp4
Binary file not shown.
Binary file added public/videos/gallery/network-dns.webm
Binary file not shown.
Binary file added public/videos/gallery/optics-lens.mp4
Binary file not shown.
Binary file added public/videos/gallery/optics-lens.webm
Binary file not shown.
Binary file added public/videos/gallery/optics-tir.mp4
Binary file not shown.
Binary file added public/videos/gallery/optics-tir.webm
Binary file not shown.
Binary file added public/videos/gallery/physics-dominoes.mp4
Binary file not shown.
Binary file added public/videos/gallery/physics-dominoes.webm
Binary file not shown.
Binary file added public/videos/gallery/physics-projectile.mp4
Binary file not shown.
Binary file added public/videos/gallery/physics-projectile.webm
Binary file not shown.
69 changes: 28 additions & 41 deletions src/components/FeatureGallery.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'react'
import { ArrowUpRight, Play, Puzzle } from 'lucide-react'
import { ArrowUpRight, Play } from 'lucide-react'
import clips from '../data/feature-gallery.json'

const filters = [
Expand All @@ -16,13 +16,6 @@ const filters = [
type Filter = typeof filters[number][0]
type Clip = typeof clips[number]

const upcoming = [
{ title: 'Molecule', summary: 'Molecular structures and chemical reactions.' },
{ title: 'Physics', summary: 'Collisions, projectiles and domino simulations.' },
{ title: 'Network', summary: 'Network topology and animated packet paths.' },
{ title: 'Optics', summary: 'Light rays, reflection and refraction.' },
]

const ClipPlayer = ({ clip }: { clip: Clip }) => {
const [playing, setPlaying] = useState(false)
const poster = clip.poster.replace('img/', '/img/gallery/')
Expand Down Expand Up @@ -66,22 +59,33 @@ const ClipPlayer = ({ clip }: { clip: Clip }) => {
)
}

const GalleryCard = ({ clip }: { clip: Clip }) => (
<article className="panel flex min-w-0 flex-col overflow-hidden">
<ClipPlayer clip={clip} />
<div className="flex flex-1 flex-col border-t border-line p-4">
<h3 className="text-base font-semibold">{clip.title}</h3>
<p className="mt-1 text-sm text-fg-2">{clip.summary}</p>
<a
href={clip.docs}
aria-label={`Documentation for ${clip.plugin}`}
className="mt-auto block w-fit max-w-full pt-3 font-mono text-xs text-accent wrap-anywhere hover:underline"
>
{clip.plugin} <ArrowUpRight size={12} aria-hidden="true" className="inline" />
</a>
</div>
</article>
)
const GalleryCard = ({ clip }: { clip: Clip }) => {
const pluginName = clip.plugin_name ?? clip.plugin

return (
<article className="panel flex min-w-0 flex-col overflow-hidden">
<ClipPlayer clip={clip} />
<div className="flex flex-1 flex-col border-t border-line p-4">
<h3 className="text-base font-semibold">{clip.title}</h3>
<p className="mt-1 text-sm text-fg-2">{clip.summary}</p>
<div className="mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-3 font-mono text-xs text-accent">
<a
href={clip.docs}
aria-label={`Documentation for ${pluginName}`}
className="max-w-full wrap-anywhere hover:underline"
>
{pluginName} <ArrowUpRight size={12} aria-hidden="true" className="inline" />
</a>
{clip.release && (
<a href={clip.release} aria-label={`${pluginName} release`} className="hover:underline">
Release <ArrowUpRight size={12} aria-hidden="true" className="inline" />
</a>
)}
</div>
</div>
</article>
)
}

export const FeatureGallery = () => {
const section = useRef<HTMLElement>(null)
Expand Down Expand Up @@ -127,23 +131,6 @@ export const FeatureGallery = () => {
<div className="mt-5 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
{visible.map((clip) => <GalleryCard key={clip.slug} clip={clip} />)}
</div>

{(filter === 'all' || filter === 'community') && (
<section aria-labelledby="upcoming-plugins-heading" className="mt-8">
<h3 id="upcoming-plugins-heading" className="text-lg font-semibold">Upcoming community plugins</h3>
<div className="mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
{upcoming.map(({ title, summary }) => (
<article key={title} className="panel p-4">
<h4 className="flex items-center gap-2 font-medium">
<Puzzle size={16} aria-hidden="true" className="text-fg-3" /> {title}
</h4>
<p className="mt-1 text-sm text-fg-2">{summary}</p>
<p className="mt-2 text-xs text-fg-3">Demo pending release</p>
</article>
))}
</div>
</section>
)}
</section>
)
}
128 changes: 128 additions & 0 deletions src/data/feature-gallery.json
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,134 @@
"webm": "videos/code-snippets-morph.webm",
"poster": "img/code-snippets-morph.webp"
},
{
"slug": "molecule-caffeine",
"title": "Caffeine draws itself",
"kinds": [
"community"
],
"plugin": "io.github.animathio.molecule",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.molecule%400.1.0/community/molecule/README.md",
"summary": "Watch Molecule Studio draw caffeine’s fused rings and atom labels bond by bond.",
"plugin_name": "Molecule Studio",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.molecule%400.1.0",
"seconds": 5.0,
"mp4": "videos/molecule-caffeine.mp4",
"webm": "videos/molecule-caffeine.webm",
"poster": "img/molecule-caffeine.webp"
},
{
"slug": "molecule-esterification",
"title": "Esterification",
"kinds": [
"community"
],
"plugin": "io.github.animathio.molecule",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.molecule%400.1.0/community/molecule/README.md",
"summary": "Molecule Studio draws acetic acid and ethanol, then reveals ethyl acetate and water.",
"plugin_name": "Molecule Studio",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.molecule%400.1.0",
"seconds": 5.0,
"mp4": "videos/molecule-esterification.mp4",
"webm": "videos/molecule-esterification.webm",
"poster": "img/molecule-esterification.webp"
},
{
"slug": "optics-lens",
"title": "Converging lens",
"kinds": [
"community"
],
"plugin": "io.github.animathio.optics",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.optics%400.1.0/community/optics/README.md",
"summary": "Follow three rays through a converging lens to an inverted real image in Ray Optics.",
"plugin_name": "Ray Optics",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.optics%400.1.0",
"seconds": 5.0,
"mp4": "videos/optics-lens.mp4",
"webm": "videos/optics-lens.webm",
"poster": "img/optics-lens.webp"
},
{
"slug": "optics-tir",
"title": "Total internal reflection",
"kinds": [
"community"
],
"plugin": "io.github.animathio.optics",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.optics%400.1.0/community/optics/README.md",
"summary": "Ray Optics sweeps the incidence angle through the critical angle until only the reflected ray remains.",
"plugin_name": "Ray Optics",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.optics%400.1.0",
"seconds": 5.0,
"mp4": "videos/optics-tir.mp4",
"webm": "videos/optics-tir.webm",
"poster": "img/optics-tir.webp"
},
{
"slug": "network-arp",
"title": "ARP request and reply",
"kinds": [
"community"
],
"plugin": "io.github.animathio.network",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.network%401.0.0/community/network/README.md",
"summary": "Net Lab floods an ARP request across a switch, then uses the learned address to ping a peer.",
"plugin_name": "Net Lab",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.network%401.0.0",
"seconds": 6.0,
"mp4": "videos/network-arp.mp4",
"webm": "videos/network-arp.webm",
"poster": "img/network-arp.webp"
},
{
"slug": "network-dns",
"title": "Recursive DNS lookup",
"kinds": [
"community"
],
"plugin": "io.github.animathio.network",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.network%401.0.0/community/network/README.md",
"summary": "Net Lab follows a query for example.test from the client to its resolver and the authoritative server.",
"plugin_name": "Net Lab",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.network%401.0.0",
"seconds": 6.0,
"mp4": "videos/network-dns.mp4",
"webm": "videos/network-dns.webm",
"poster": "img/network-dns.webp"
},
{
"slug": "physics-projectile",
"title": "Projectile trajectories",
"kinds": [
"community"
],
"plugin": "io.github.animathio.physics",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.physics%400.1.0/community/physics/README.md",
"summary": "Compare launch angles and follow the velocity arrow along the highlighted trajectory.",
"plugin_name": "Physics Play",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.physics%400.1.0",
"seconds": 5.0,
"mp4": "videos/physics-projectile.mp4",
"webm": "videos/physics-projectile.webm",
"poster": "img/physics-projectile.webp"
},
{
"slug": "physics-dominoes",
"title": "Domino chain reaction",
"kinds": [
"community"
],
"plugin": "io.github.animathio.physics",
"docs": "https://github.com/AniMathIO/plugins/blob/io.github.animathio.physics%400.1.0/community/physics/README.md",
"summary": "A rolling ball tips the first domino, and each contact carries the motion down the row.",
"plugin_name": "Physics Play",
"release": "https://github.com/AniMathIO/plugins/releases/tag/io.github.animathio.physics%400.1.0",
"seconds": 5.0,
"mp4": "videos/physics-dominoes.mp4",
"webm": "videos/physics-dominoes.webm",
"poster": "img/physics-dominoes.webp"
},
{
"slug": "webm-export",
"title": "WebM export",
Expand Down
Loading