1.0.2 • Published 2 years ago

acnhmsgbox v1.0.2

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

Animal Crossing Message Box

acnhMsgBox is a library who create you a message box like in Animal Crossing New Horizon

imageBefore

imageAfter

Getting Started

⚠️ | This library should be used in a browser, it's doesn't work in Node.js environment

Installing

Install with npm

npm install acnhmsgbox

or with the -s parameters if you want install it and adds the entry to the package.json file dependencies

npm install acnhmsgbox -s

Example

Open the index.html in the example folder and enjoy :)

How to use

Like that

<script type="text/javascript" src="./acnhMessageBox.js"></script>
<script type="text/javascript">
var msgBox = new ACMsgBox({
	title: "Mélo",
	idDiv: "svgDiv",
	textWriteInProcess: true, 
	lines:{
		1: ["Et voilà ! Je peux te racheter le tout"], 
		2: ["pour {1 988 000 clochettes.} Qu'est-ce"], 
		3: ["que tu en dis ?"]
	}
})

function draw() {
	msgBox.draw()
}
</script>

Documentation

Constructor options

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
titleStringMéloTitle of the message box (7 characters max)
idDivStringnoneIf it's not set, the SVG will displayed at the end of your body element
textWriteInProcessBooleanfalseIf it's set to false, the text will not be write by the library
linesObjectnullObject who contain text to display, 3 lines max. (After much tests, I advise 37 characters length per lines)
new ACMsgBox({
	title: "Server", // If title is not set, default title is "Mélo"
	idDiv: "svgDiv", // The id of the div where you want to display the SVG
	textWriteInProcess: true, 
	lines:{
		1: ["Et voilà ! Je peux te racheter le tout"], 
		2: ["pour {1 988 000 clochettes.} Qu'est-ce"], 
		3: ["que tu en dis ?"]
	}
})

Methods

draw()

Draw the message box. (⚠️ | Without calling this method, your message box doesn't display)

ACMsgBox.draw()

Authors

License

This project is licensed under the ISC License - see the LICENSE file for details