A modern TypeScript implementation of the classic Microsoft Office Assistant (Clippy)
npm install modern-clippyA 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
``bash`
npm install modern-clippy
`javascript
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:
`javascript
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();
`
`html`
`jsx
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
$3
`vue
`$3
`html
`API Reference
$3
Initializes Clippy with optional configuration.
`typescript
interface ClippyOptions {
basePath?: string; // Base path for static assets
}
`$3
`typescript
clippy.speak(text: string, duration?: number): void; // Show a speech bubble
clippy.play(animationName: string): Promise; // Play an animation
clippy.moveTo(x: number, y: number): void; // Move Clippy to position
clippy.show(): void; // Show Clippy
clippy.hide(): void; // Hide Clippy
`$3
-
Idle: Default idle position
- Wave: Friendly greeting wave
- Thinking: Shows Clippy in contemplation
- Explain: Used when providing information
- GetAttention: Animated gesture to draw attention
- Congratulate: Celebration animationEach animation can be played using:
`typescript// 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?");
`Project Structure
`
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
`Building
`bash
Install dependencies
npm installBuild the project
npm run build
`Development
`bash
Start development server
npm run devBuild for production
npm run buildPreview 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