You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Add the stylesheet to the head --><linkrel="stylesheet" type="text/css" href="https://gitcdn.xyz/repo/pi0/clippyjs/master/assets/clippy.css"><!-- Add these scripts to the bottom of the page --><scriptsrc="https://unpkg.com/jquery@3.2.1"></script><scriptsrc="https://unpkg.com/clippyjs@latest"></script><scripttype="text/javascript">clippy.load('Merlin',function(agent){// Do anything with the loaded agentagent.show();});</script>
NPM / Webpack
Install dependency
yarn add clippyjs # or npm install clippyjs
Import and load
importclippyfrom'clippyjs'clippy.load('Merlin',(agent)=>{// do anything with the loaded agentagent.show();});
NOTEassets dir is not shipped with npm package for lighter package size.
However it should work fine as assets are served from CDN by default. See CDN section below.
Actions
All the agent actions are queued and executed by order, so you could stack them.
// play a given animationagent.play('Searching');// play a random animationagent.animate();// get a list of all the animationsagent.animations();// => ["MoveLeft", "Congratulate", "Hide", "Pleased", "Acknowledge", ...]// Show text balloonagent.speak('When all else fails, bind some paper together. My name is Clippy.');// move to the given point, use animation if availableagent.moveTo(100,100);// gesture at a given point (if gesture animation is available)agent.gestureAt(200,200);// stop the current action in the queueagent.stopCurrent();// stop all actions in the queue and go back to idle modeagent.stop();
Custom CDN / Agents
By default all agents are being served from GitHub CDN (this repo) in order to customize loading base path,
You can set window.CLIPPY_CDN or use fourth argument of load function it can be absolute URL or relative to script.
(path should end with slash /)
// Using global configwindow.CLIPPY_CDN='./agents/'// Or using fourth argumentclippy.load('Marline',function(){// ...},undefined,'./agents/')