I want to use paper.js in one of my components in Angular 2 but cannot seem to get it to work. The paper-full.js file runs when the component is loaded but it never recognizes the canvas.
There is a typings file made by Clark-Stevenson (paper.d.ts) for paper.js and I think this might be part of the issue but when I try to install it following Ben Nadel's general instructions (see link) I get the following:
C:\Users\levi\Documents\Programming\AngularDesigner2>./node_modules/.bin/typingsinstall --global --save file:./paper.d.ts
'.' is not recognized as an internal or external command, operable program or batch file.
https://github.com/clark-stevenson/paper.d.ts I am new to paper.js, typescript and angular 2.
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"paper.d.ts"
]
}
App.component.ts
import { Component } from '@angular/core';
import '../../node_modules/paper/dist/docs/assets/js/paper.js';
@Component({
selector: 'my-app',
templateUrl: 'app/canvas.html'
})
export class AppComponent {
}
canvas.html
<h1>Canvas</h1>
<canvas id="canvas"></canvas>
The paper.d.ts file is found under src: src/paper.d.ts