Skip to content
New issue

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

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

Already on GitHub? # to your account

Make duration an optional keyword argument #182

Merged
merged 2 commits into from
Oct 17, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* `on_form_load()` can be used in a `routing.main_router` Form
This method will be fired with the current `url_hash` and the `form` that was added to the `content_panel`.
https://github.com/anvilistas/anvil-extras/pull/180
* `animate` duration argument is no longer keyword only i.e. `animate(self, fade_in, 300)` is valid
https://github.com/anvilistas/anvil-extras/pull/182

# v1.8.1 14-Oct-2021

Expand Down
7 changes: 4 additions & 3 deletions client_code/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,17 @@ class Effect:
The first argument should be a Transition object.
The remainder of the values are timing options"""

def __new__(cls, transition=None, **timings):
def __new__(cls, transition=None, duration=333, **timings):
if isinstance(transition, Transition):
transition = transition._compute()
timings["duration"] = duration
return _window.KeyframeEffect(None, transition, timings)

def __init__(
self,
transition=None,
*,
duration=333,
*,
delay=0,
direction="normal",
easing="linear",
Expand Down Expand Up @@ -392,8 +393,8 @@ def getTiming(self, component):
def animate(
component,
transition=None,
*,
duration=333,
*,
start_at=None,
end_at=None,
use_ghost=False,
Expand Down