A small function that will convert normal string to emoji text. This does require p5.js
[Optional] change the sprites to your preferred sprites / emoji. Ensure the image files are still named appropriately. (the sprite that represent 'a' is still named 'a.png')
In the html file ensure to load the script file before your main file. For example:
<script src="./keyParse.js"></script>
<script src="./script.js"></script>Must have all the alphabet sprites in the folder keys.
To use the
printEmojiText()function we must first load the sprites by calling theloadKeySprites()function in the p5.jsfunction preload(){}
After which we can call the
printEmojiText()function in thefunction draw(){}of the p5.js file
An example use case of this would be:
function preload() {
loadKeySprites();
}
function setup() {
createCanvas(1280, 720);
}
function draw() {
printEmojiText("wanted text", width / 2, height / 2, 24);
}