Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port AutoLine over to new framework #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ejnnr
Copy link
Contributor

@ejnnr ejnnr commented Jan 25, 2024

This PR replaces #10 (though it doesn't have all the same features yet).

Example usage that works:

box_a = ice.Rectangle(ice.Bounds(0, 0, size=(50, 50)), border_color=ice.Colors.BLACK)
box_b = ice.Rectangle(
    ice.Bounds(200, 400, size=(50, 50)), border_color=ice.Colors.BLACK
)
line = ice.AutoLine(
    box_a,
    box_b,
    directions="rdrdl",
    path_style=ice.PathStyle(color=ice.Colors.RED),
    x_padding=20,
    corner_radius=10,
)
scene = ice.Compose(box_a, box_b, line)

image

Animation example that doesn't work yet:

class Animation(ice.Playbook):
    def timeline(self):
        box_a = ice.Rectangle(
            ice.Bounds(0, 0, size=(50, 50)), border_color=ice.Colors.BLACK
        )
        box_b = ice.Rectangle(
            ice.Bounds(200, 400, size=(50, 50)), border_color=ice.Colors.BLACK
        )

        directions = ["rdrdl", "rurdl"]
        lines = [
            ice.AutoLine(
                box_a,
                box_b,
                directions=d,
                path_style=ice.PathStyle(color=ice.Colors.RED),
                x_padding=20,
                y_padding=20,
                corner_radius=10,
            )
            for d in directions
        ]

        line = ice.Animated(lines, 1.0)

        scene = (
            ice.Compose(box_a, box_b, line)
            .pad(20)
            .background(ice.Colors.WHITE)
            .scale(2)
        )
        self.play(scene)


Animation().ipython_display(display_format="gif")

(just jumps suddenly)

revalo added a commit that referenced this pull request Jan 31, 2024
revalo added a commit that referenced this pull request May 8, 2024
revalo added a commit that referenced this pull request May 8, 2024
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.

1 participant