Emojis are just single characters, and the canvas-method fillText can render text at any x/y-pos...
So, what you need (in a "basic setup") - is actually quite simple:
html:
js-code:Code:<!DOCTYPE html> <html> <body> <canvas id="c1" width="320" height="240" style="background:black" /> </body> </html>
Ah.. well - have made a fiddle here: https://jsfiddle.net/t8k2bnea/1/Code:function rr(min, max){ return Math.floor(Math.random()*(max-min) + min) } var arr = "😃,🤢,🥶,💔".split(","); var ctx = document.getElementById("c1").getContext("2d") setInterval(()=>{ ctx.font = rr(15,30).toString() + "px Arial" ctx.clearRect(0, 0, 320, 240) arr.forEach((e_char)=>{ var x = rr(0, 320), y = rr(0, 240) ctx.fillText(e_char, x, y) }) }, 100)
HTH
Olaf




Reply With Quote
