Giter Club home page Giter Club logo

vue-skycons's Introduction

Vue Skycons

vue 2x npm npm download per month Libraries.io dependency status for latest release NPM license

This was inspired by Skycons -- a set of ten animated weather glyphs, procedurally generated by JavaScript using the HTML5 canvas tag. They're easy to use, and pretty lightweight, so they shouldn't rain on your parade.

icons.gif

Installation

NPM

npm install --save vue-skycons

YARN

yarn add vue-skycons

Examples

Register Component

import Vue from "vue";
import Skycon from "vue-skycons";

Vue.component("skycon", Skycon);

Using Component

<template>
  <div>
    <!-- all icons -->
    <skycon condition="clear-day" />
    <skycon condition="clear-night" />
    <skycon condition="partly-cloudy-day" />
    <skycon condition="partly-cloudy-night" />
    <skycon condition="cloudy" />
    <skycon condition="rain" />
    <skycon condition="sleet" />
    <skycon condition="snow" />
    <skycon condition="wind" />
    <skycon condition="fog" />

    <!-- all attributes -->
    <skycon condition="rain" size="128" color="orangered" paused @load="console.log" />
  </div>
</template>

<script>
import Skycon from "vue-skycons";

export default {
  components: {
    Skycon
  }
}

Available props

// Weather condition
condition: {
  type: String,
  required: true,
},

// Icon size
size: {
  type: [Number, String],
  default: 64,
},

// Icon color
color: {
  type: String,
  default: "black",
},

// Start with paused animation
paused: {
  type: Boolean,
  default: false,
},

// The animation speed
speed: {
  type: [Number, String],
  default: 1
}

Event example

<template>
  <skycon condition="snow" size="128" paused @load="onLoad" />
</template>

<script>
export default {
  methods: {
    onLoad(player) {
      console.log("loaded");
      setInterval(() => {
        if (player.paused) {
          player.play();
        } else {
          player.pause();
        }
      }, 1000);
    }
  }
};
</script>

Animation Speed

The speed attributes is a decimal number to control the animation speed. It is a multiplyer to the original speed. 1 means the normal speed. 0.5 means half the normal speed. 2 means twice as fast as the normal speed.

<template>
  <skycon condition="wind" size="128" speed="1" />
  <skycon condition="wind" size="128" speed="3" />
  <skycon condition="wind" size="128" speed="0.5" />
</template>

vue-skycons's People

Contributors

dipu-bd avatar dependabot[bot] avatar thegrossman avatar loop0 avatar esamattis avatar gasperk avatar maxdow avatar tbarmann 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.