A modern, TypeScript implementation of the classic Microsoft Office Assistant (Clippy) for web applications. This lightweight library brings back the nostalgic office assistant with modern web technologies and improved functionality.
- ๐ฏ Lightweight and dependency-free
- ๐ Written in TypeScript
- ๐จ Smooth animations
- ๐ฌ Speech bubbles with customizable messages
- ๐ Easy integration with any web application
- ๐ฎ Interactive animations and movements
- ๐ฑ Responsive and mobile-friendly
npm install modern-clippy
import { initClippy } from 'modern-clippy';
async function init() {
const clippy = await initClippy();
clippy.speak("Hello! Need help?");
}
init();
If your static assets are served from a different path:
import { initClippy } from 'modern-clippy';
async function init() {
const clippy = await initClippy({
basePath: "/static/clippy" // Path to your clippy assets
});
clippy.speak("Hello! Need help?");
}
init();
<script type="module">
import { initClippy } from './modern-clippy.js';
let clippy;
async function init() {
clippy = await initClippy();
clippy.speak("Hello!");
}
init();
</script>
import { useEffect } from 'react';
import { initClippy } from 'modern-clippy';
function App() {
useEffect(() => {
const loadClippy = async () => {
const clippy = await initClippy();
clippy.speak('Hello from React!');
};
loadClippy();
}, []);
return <div>Your App Content</div>;
}
<script setup>
import { onMounted } from 'vue';
import { initClippy } from 'modern-clippy';
onMounted(async () => {
const clippy = await initClippy();
clippy.speak('Hello from Vue!');
});
</script>
<script type="module">
import { initClippy } from "{{ url_for('static', filename='clippy/modern-clippy.js') }}";
async function init() {
const clippy = await initClippy({
basePath: "/static/clippy"
});
clippy.speak("Hello from Flask!");
}
init();
</script>
Initializes Clippy with optional configuration.
interface ClippyOptions {
basePath?: string; // Base path for static assets
}
clippy.speak(text: string, duration?: number): void; // Show a speech bubble
clippy.play(animationName: string): Promise<void>; // Play an animation
clippy.moveTo(x: number, y: number): void; // Move Clippy to position
clippy.show(): void; // Show Clippy
clippy.hide(): void; // Hide Clippy
Idle
: Default idle positionWave
: Friendly greeting waveThinking
: Shows Clippy in contemplationExplain
: Used when providing informationGetAttention
: Animated gesture to draw attentionCongratulate
: Celebration animation
Each animation can be played using:
// Example: Thinking animation with speech
clippy.play('Thinking');
clippy.speak("Hmm, let me think about that...");
// Example: Getting attention before important message
clippy.play('GetAttention');
clippy.speak("Hey! Did you know you can use all these animations?");
modern-clippy/
โโโ src/
โ โโโ agent.ts # Main Clippy agent class
โ โโโ types.ts # TypeScript interfaces
โ โโโ loader.ts # Asset loader functionality
โ โโโ sprites.ts # Sprite definitions
โ โโโ index.ts # Main entry point
โโโ dist/ # Built files
โโโ public/ # Static assets
โโโ agents/
โโโ Clippy/
โโโ map.png # Clippy sprite sheet
# Install dependencies
npm install
# Build the project
npm run build
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
This project is licensed under the MIT License - see the LICENSE file for details.
- Original Clippy assets from Microsoft Office
- Inspired by the classic ClippyJS