Repository navigation
feat(viewer): a photo flies out of the spot it was shown in, and back - #28
Merged
Merged
Conversation
A Photo may say where it was on the screen before the viewer opened it (Photo::from, a Spot: a thumbnail's box, or the point a finger pressed). The viewer flies it out of that spot to fill the window as it opens, and back into it as it closes, by its button, Escape or a drag down, as a phone's Photos app does. A photo with no spot fades in growing a little where it rests, and fades out shrinking where it is. Asked to close, the viewer goes first and then calls onclose. The flights are timed in Rust on the viewer's own frames, as its drag down is, and take the theme's motion: a new Motion::travel for a flight, enter and exit for a fade, none where less motion is asked for. The gallery's photos fly out of where they were pressed.
…pped as the viewer steps them
adammharris
force-pushed
the
cc/practical-pasteur-evqtf1
branch
from
November 18, 2026 03:02
66e1363 to
827571c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The photo viewer now opens and closes with motion. It already had a drag-down dismissal, but opening it, its Close button and Escape had no animation. A host can now say where a photo was on screen before it opened, and the photo flies to and from that spot.
Spot(exported, also in the prelude): a box on the screen in the window's CSS pixels, eitherSpot::rect(x, y, w, h)for a thumbnail orSpot::point(x, y)for where a finger pressed. A point is a spot with no size, so the photo grows out of it.Photo::from(spot): optional, and set per photo.sizeis drawnobject-fit: coverinside its moving box. A square thumbnail therefore opens into the full photo the way a phone's Photos app does.onclose. A page that setsopen = falseon its own still closes at once.Timing
Flights run in Rust on the viewer's own frames, the same way the drag-down and the slide do. That's because the flight's start point is dynamic (where the finger let go), and
onclosehas to fire when the flight ends.Motiongains atravelfield: 300ms for unit, 400ms for Soft, 160ms for Sharp. A fade without a spot usesenterandexit.Theme::travel_msandTheme::enter_mssit besideexit_ms. All return 0 underMotionSetting::Reducedor cell density, and the viewer then opens and closes at once.cubic-bezier(0.2, 0, 0, 1), evaluated in Rust.Motiongains a public field, so code that builds aMotionwith a struct literal needs atravel. Diaryx builds its theme with..Theme::soft(), so it isn't affected.Gallery
Photos opened from the Photos grid fly out of the point where they were pressed. "View Photos…" has no spot, so it fades.
Tests
zoom.rs: a flight's path and fade over time, a zero-length flight, a spot placed on the stage, and where a dragged-down photo is actually drawn.All of the
ship cilanes pass locally: fmt, clippy (native and wasm), tests light and dark, and docs.