1.0.4 • Published 2 years ago

cows.js v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

cows.js

Cows.js is a stand alone javascript library that adds random cows to the web.

Installation

npm i cows.js -- save

JS

The setup to run cows.js is fairly simple. You will have to create a new instance of a Cow, and pass it an element id of a div or other container. The library will automatially set the css of the element you pass, so that it contains the entire webpage. This is so the cow can spawn and walk across any location.

<div id="cow"></div>

<script type="module">
//import the Cow module
import * as Cow from '/node_modules/cows.js/cow.js'

// Cow script included on the page, already.
window.onload = function () {
    var cow = new Cow.default({
        id: 'cow'
    });

    //will call the cow to walk
    cow.move();
}
</script>

Audio

You can control whether you want the cow to "moo" or not. The audio will play as default, but you can set the sound setting to false to stop the audio as seen in the example below..

<div id="cow"></div>

<script type="module">

window.onload = function () {
    var cow = new Cow.default({
        id: 'cow',
        sound: false
    });

    cow.move();
}
</script>
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago