Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

pipe

Canvas "pipe" between two points.

Installation

$ component install component/pipe

Example

<canvaswidth=1000height=1000style="border: 1px solid #eee"></canvas><script>varraf=require('raf');varpipe=require('pipe');varcanvas=document.querySelector('canvas');varctx=canvas.getContext('2d');vara={x: 500,y: 300};varb={x: 500,y: 500};varg=0;varx;vary;canvas.onmousemove=function(e){x=e.offsetX;y=e.offsetY;};functiondraw(){ctx.strokeStyle='#ddd';canvas.width=canvas.width;b.x=x;b.y=y;pipe(ctx,a,b);}functionanimate(){raf(animate);draw();}animate();</script>

License

MIT

About

Canvas pipe connection between two points

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages