This skill enables WorkBuddy to create, demonstrate, and generate Anime.js animations. Anime.js is a lightweight JavaScript animation library that can animate CSS properties, SVG paths, DOM elements, and create timeline-based animations.
When this skill is triggered, WorkBuddy should:
show_widget (if requested or appropriate)
When the user wants to see an animation effect, use show_widget to create an interactive HTML widget that demonstrates the animation.
Key requirements:
https://unpkg.com/animejs@3.2.2/lib/anime.min.js
and
Example structure:
<div style="...">
<h3>Animation Demo</h3>
<div id="demo-container" style="...">
<!-- Animation elements here -->
</div>
<button onclick="runAnimation()">Run</button>
</div>
<script src="https://unpkg.com/animejs@3.2.2/lib/anime.min.js"></script>
<script>
function runAnimation() {
anime({ /* animation config */ });
}
</script>
When the user needs code to use in their project, generate a complete HTML file with:
Code template:
<!DOCTYPE html>
<html>
<head>
<title>Anime.js Animation</title>
<script src="https://unpkg.com/animejs@3.2.2/lib/anime.min.js"></script>
<style>
/* Styles for animated elements */
</style>
</head>
<body>
<!-- Animated elements -->
<script>
// Anime.js animation code
anime({
targets: '...',
// animation properties
});
</script>
</body>
</html>
Animate position, rotation, scale, and opacity of DOM elements.
anime({
targets: '.box',
translateX: 250,
rotate: 360,
scale: 2,
duration: 1000,
easing: 'easeInOutQuad'
});
Animate multiple elements with sequential delays.
anime({
targets: '.item',
scale: [0, 1],
delay: anime.stagger(100), // 100ms delay between each
easing: 'easeOutQuad'
});
Animate elements along SVG paths.
anime({
targets: 'circle',
translateX: anime.path('path').x,
translateY: anime.path('path').y,
duration: 2000,
easing: 'easeInOutSine'
});
Chain multiple animations with precise timing.
var timeline = anime.timeline({
easing: 'easeOutQuad',
loop: true
});
timeline
.add({ targets: '.el1', translateX: 250, duration: 500 })
.add({ targets: '.el2', translateX: 250, duration: 500 }, '-=400'); // overlap 400ms
When user requests an animation:
show_widget to display interactive demo in conversation
Contains Anime.js API reference with all available properties, easing functions, and methods. Load this file when needing to check API details (properties, easing, timeline syntax, etc.).
Contains 15+ example animations with code snippets for common use cases. Load this file when needing inspiration or code examples for specific animation types (stagger, timeline, SVG path, etc.).
共 1 个版本