Created
May 6, 2017 01:15
-
-
Save donpark/f5e46b6afd1a8b166dc742f012b26a41 to your computer and use it in GitHub Desktop.
Setup Paper.js for use in React.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { Component } from 'react' | |
import { PaperScope } from 'paper' | |
export class PaperSetup extends Component<any, any> { | |
constructor(props) { | |
super(props) | |
window['paper'] = new PaperScope() | |
} | |
render() { | |
return ( | |
<canvas id="paper" width={0} height={0} /> | |
) | |
} | |
componentDidMount() { | |
let scope = window['paper'] as PaperScope | |
scope.setup(document.getElementById('#paper') as HTMLCanvasElement) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment