Skip to content
Open
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
16 changes: 9 additions & 7 deletions Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@
},
onChange: style => (checkStyle = style)
});
function runAnimations() {
borderAnimation.play();
checkAnimation.play();
}
function runReversedAnimations() {
borderAnimation.reverse();
checkAnimation.reverse();
}
$: checked ? runAnimations() : runReversedAnimations()

const handleChange = () => {
if (!canChange) return false;
if (checked) {
borderAnimation.reverse();
checkAnimation.reverse();
} else {
borderAnimation.play();
checkAnimation.play();
}
canChange = false;
checked = !checked;
dispatch("change", checked);
Expand Down