Uso un script Video to ASCII en JavaScript, pero el problema es que cuando uso una cadena de JavaScript simple para la salida, funciona perfectamente y el video ASCII se reproduce sin problemas en escala de grises. mira aquí, uso una cadena de JavaScript simple sin código HTML.
str += this.getChar(val)pero cuando trato de reproducir video ASCII en modo de color y uso la etiqueta de estilo HTML con color RGB, entonces reproduce la salida de video ASCII en color RGB completo, pero el video ASCII es un marco que se salta y no se reproduce sin problemas. Creo que tal vez se deba a que el procesador es lento para procesar el código HTML en cada línea ASCII. Mira aquí, uso código HTML con una cadena de JavaScript.
str += `<font style="color: rgb(${r}, ${g}, ${b})">${this.getChar(val)}</font>`;o usa esto
str += "<span style=\"color: rgb("+r+","+g+","+b+"); \">"+ this.getChar(val) +"</span>";Alguien sugiere una solución para reproducir video ASCII sin problemas en modo a todo color. su ayuda será apreciada.
para su referencia Aquí está una parte del código de secuencia de comandos ASCII to Video.
getChar: function (val) { return this.asciiChars[parseInt(val * this.asciiLength, 10)]; }, getAsciiString: function () { var len = this.width * this.height, d = this.imageData, str = '', row = 0; for (var currentPixel = 0; currentPixel < len; currentPixel++) { if ( currentPixel % this.width === 0 && currentPixel != 0 ) { str += '\n'; row++; } var r = d[currentPixel * 4]; var g = d[(currentPixel * 4) + 1]; var b = d[(currentPixel * 4) + 2]; val = ~~(r * 0.299 + g * 0.587 + b * 0.114 ) / 256; // this simple string code play ASCII video smoothly but in gray scale str += this.getChar(val) // and when i use any of this HTML code, Output ASCII video is in full color but jerking, skipping frames, not play smoothly :( , currently i add // before both HTML codes because above i was using simple string. // str += `<font style="color: rgb(${r}, ${g}, ${b})">${this.getChar(val)}</font>`; // str += "<span style=\"color: rgb("+r+","+g+","+b+"); \">"+ this.getChar(val) +"</span>"; } return str; } }