1.2.0 • Published 3 years ago

vue-pencil.js v1.2.0

Weekly downloads
19
License
MIT
Repository
github
Last release
3 years ago

vue-pencil.js logo

vue-pencil.js

Pencil.js ❤️ Vue - Build reactive 2D graphics scene in your Vue project

Install

npm install vue-pencil.js

You need to install vue and pencil.js yourself alongside vue-pencil.js.

Usage

You have 3 choices: 1. Install vue-pencil.js globally and use it wherever you want in your Vuejs app. 2. Import only components you need in your Vuejs components. 3. Use a direct <script> tag to include from a CDN.

1. Global install

import Vue from "vue";
import Pencil from "vue-pencil.js";

const options = {
    prefix: "p", // Change the component's prefix (default: "p")
};
Vue.use(Pencil, options);

new Vue({
    el: "#app",
    template: `
        <p-scene>
            <p-circle :radius="100" :position="[100, 100]" />
        </p-scene>
    `,
});

2. Import component

<template>
    <PScene>
        <PCircle :radius="100" :position="[100, 100]" />
    </PScene>
</template>

<script>
    import { Components } from "vue-pencil.js";
    const { PScene, PCircle } = Components;

    export default {
        name: "App",
        components: {
            PScene,
            PCircle,
        },
    };
</script>

3. Direct <script> tag

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Example</title>
</head>
<body>
    <div id="app"></div>
    <!-- Vue script tag-->
    <script src="https://unpkg.com/vue"></script>
    <!-- Pencil.js script tag-->
    <script src="https://unpkg.com/pencil.js"></script>
    <!-- vue-pencil.js script tag-->
    <script src="https://unpkg.com/vue-pencil.js"></script>
    <script>
        new Vue({
            el: "#app",
            template: `
                <p-scene>
                    <p-circle :radius="100" :position="[100, 100]" />
                </p-scene>
            `,
        });
    </script>
</body>
</html>

Example

Check out working examples in the examples directory.

Contributing

Any contribution abiding to the code of conduct is welcome.

License

MIT

1.2.0

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago