Code Monkey home page Code Monkey logo

vue-dat-gui's Introduction

vue-dat-gui

vue-dat-gui

A Vue.js port of the popular dat.GUI library.

This is a lightwieght graphical user interface to change variables in Javascript. Useful for all your demo or experiment code.

DEMO โœจ

Check out the demo page.

Used by:


INSTALL ๐Ÿ’ป

Option 1 - Install from NPM

npm install --save @cyrilf/vue-dat-gui

Then the usage is:

import Vue from 'vue'
import DatGui from '@cyrilf/vue-dat-gui'

Vue.use(DatGui)

Option 2 - Instal via umd file

In your head tag, include the following code:

<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://unpkg.com/@cyrilf/vue-dat-gui@latest/dist/vue-dat-gui.umd.min.js"></script>

USAGE ๐Ÿ–ฑ

You can always refer to the public/index.html file for the most up-to-date example of how to use it. The demo page is also available.

In your view:

<div class="app">
  <dat-gui closeText="Close controls" openText="Open controls" closePosition="bottom">
    <dat-color v-model="background" label="Background"/>
    <dat-number v-model="titleFontSize" label="Title font-size"/>
    <dat-string v-model="title" label="Title"/>
    <dat-button @click="triggerAlert" label="Trigger alert"/>
    <dat-folder label="Picture">
      <dat-select v-model="pictureUrl" :items="pictures" label="Picture"/>
      <dat-boolean v-model="showPicture" label="Show Picture"/>
      <dat-folder label="Box shadow">
        <dat-number v-model="boxShadow.offsetX" :min="-100" :max="100" :step="1" label="Offset X"/>
        <dat-number v-model="boxShadow.offsetY" :min="-100" :max="100" :step="1" label="Offset Y"/>
        <dat-number v-model="boxShadow.blurRadius" :min="0" :max="100" :step="1" label="Blur radius"/>
        <dat-number v-model="boxShadow.spreadRadius" label="Spread radius"/>
        <dat-color v-model="boxShadow.color" label="Color"/>
      </dat-folder>
    </dat-folder>
  </dat-gui>
</div>

In your javascript:

import Vue from 'vue'
import DatGui from '@cyrilf/vue-dat-gui'

Vue.use(DatGui)

new Vue({
      el: '#app',
      data() {
        return {
          background: '#cdeecc',
          titleFontSize: 75,
          title: 'vue-dat-gui',
          showPicture: true,
          pictures: [{ name: 'forest', value: '...' }, { name: 'mountain', value: '...' }],
          pictureUrl: pictures[0].value,
          boxShadow: {
            offsetX: 27,
            offsetY: 27,
            blurRadius: 75,
            spreadRadius: 2,
            color: 'rgba(3, 23, 6, 1)',
          },
        }
      },
      methods: {
        triggerAlert() {
          alert('Yeah, you pressed it!')
        },
      }
    })

CONTRIBUTE ๐Ÿ–‹

Here are the different options:

npm install

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference. This project was generated using vue-cli.

Feel free to open any Pull Request/Issues.


THANKS ๐Ÿ‘Œ

vue-dat-gui's People

Contributors

cyrilf avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.