Skip to content

Add side_by_side() for horizontal animation concatenation#50

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/render-side-by-side-animations
Draft

Add side_by_side() for horizontal animation concatenation#50
Copilot wants to merge 4 commits intomainfrom
copilot/render-side-by-side-animations

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 10, 2025

Enables rendering multiple animations horizontally concatenated, playing simultaneously frame-by-frame.

Changes

  • side_by_side(streams, uri) - New function in core.py for combining streams horizontally
  • SideBySideStreams - New class in streams.py handling frame concatenation logic
    • Uses np.hstack() for efficient horizontal combination
    • Pads shorter streams by repeating last frame to match longest
    • Pads shorter heights with black pixels to align tops
    • Handles GIF (duration arrays) and MP4 (init_video_stream) format differences

Usage

from streamjoy import side_by_side, stream

stream1 = stream(resources=df, x='date', y='temperature', extension=".gif")
stream2 = stream(resources=df, x='date', y='humidity', extension=".gif")

side_by_side([stream1, stream2], uri="comparison.gif")

Works with any number of streams. Returns SideBySideStreams object when uri=None, otherwise writes and returns the path/BytesIO.

Implementation Notes

  • Type annotation fixed: returns SideBySideStreams | Path | BytesIO
  • __len__() returns max frame count (differs from ConnectedStreams which sums)
  • __iter__() returns Iterable[MediaStream] not Iterable[Path]
Original prompt

This section details on the original issue you should resolve

<issue_title>Side by side animations</issue_title>
<issue_description>Render two animations side by side.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 10, 2025 08:25
Co-authored-by: ahuang11 <15331990+ahuang11@users.noreply.github.com>
Co-authored-by: ahuang11 <15331990+ahuang11@users.noreply.github.com>
…tion

Co-authored-by: ahuang11 <15331990+ahuang11@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to render animations side by side Add side_by_side() for horizontal animation concatenation Dec 10, 2025
Copilot AI requested a review from ahuang11 December 10, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Side by side animations

2 participants