Skip to content

feat: animate hide #88

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
59 changes: 59 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<title>Rough Notation Demo</title>
<style>
body {
font-family: sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
#annotated-text {
font-size: 2em;
padding: 20px;
border: 1px solid #ccc;
cursor: pointer;
}
.instructions {
margin-top: 20px;
font-size: 1em;
color: #555;
}
</style>
</head>
<body>
<div id="annotated-text">Click me to toggle the annotation.</div>

<div class="instructions">
This demo shows the animated `hide()` method.
</div>

<script src="lib/rough-notation.iife.js"></script>
<script>
const { annotate } = RoughNotation;

const el = document.getElementById("annotated-text");
const annotation = annotate(el, {
type: "underline",
color: "red",
animationDuration: 1000,
animateOnHide: true,
});

el.addEventListener("click", () => {
if (annotation.isShowing()) {
annotation.hide();
} else {
annotation.show();
}
});

// Initially show the annotation
annotation.show();
</script>
</body>
</html>
Loading