Files
DefinitelyTyped/paper/paper-tests.ts
Kanchalai Tanglertsampan a71aff44a2 Address tests failure
2016-11-10 13:48:46 -08:00

37 lines
859 B
TypeScript

import paper = require('paper');
var canvas = document.createElement('canvas')
paper.setup(canvas);
// Circle
var path = paper.Path.Circle({
center: [80, 50],
radius: 35,
fillColor: 'red'
});
// Dotted Line Tool
var dottedLinePath: paper.Path;
var dottedLineTool = new paper.Tool();
dottedLineTool.onMouseDown = function(event: any) {
new paper.Layer().activate();
dottedLinePath = new paper.Path();
dottedLinePath.strokeColor = '#00';
dottedLinePath.strokeWidth = 2;
dottedLinePath.dashArray = [5, 8];
dottedLinePath.strokeCap = 'round';
dottedLinePath.strokeJoin = 'round';
dottedLinePath.add(event.point);
};
dottedLineTool.onMouseDrag = function(event: any) {
dottedLinePath.add(event.point);
};
dottedLineTool.onMouseUp = function(event: any) {
dottedLinePath.smooth();
dottedLinePath.simplify();
};