import { sparklineSVG } from "https://esm.town/v/stevekrouse/sparklineSVG";
export const sparklineEx2 = async (req: Request) => {
const data = [5, 10, 5, 20, 8, 15];
const svg = sparklineSVG(data, { width: 100, height: 20 });
const html = `
<!DOCTYPE html>
<html>
<head>
<title>Sparkline SVG with Animated Cat</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
text-align: center;
}
.cat {
position: absolute;
width: 50px;
height: 50px;
background: url('https://media.giphy.com/media/JIX9t2j0ZTN9S/giphy.gif') no-repeat center center;
background-size: cover;
animation: moveCat 5s infinite alternate;
}
@keyframes moveCat {
from {
top: 0;
left: 0;
}
to {
top: 80%;
left: 80%;
}
}
</style>
</head>
<body>
<div class="container">
<h1>Sparkline SVG with Animated Cat</h1>
<div>${svg}</div>
<div class="cat"></div>
</div>
</body>
</html>
`;
return new Response(html, {
headers: { "Content-Type": "text/html" },
});
}