Skip to content
/ cow.js Public

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

License

Notifications You must be signed in to change notification settings

radkinz/cow.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published