samedi 14 mars 2020

If statement not catching variable?

So I am getting the length of some data images that update every second or so the first data image is completely black and blank so it always has the same size when my canvas renders the scene the data image size changes this is what I am trying to catch, anyways my below If statement doesn't seem to catch the change in the var what am I doing wrong? Everything works fine apart from the if statement.

function render() {
 renderergl.render( scene, camera );
 testa();
}


// First Image Store Nunber
var previousImgFileSize;
var data_urlii = renderergl.domElement.toDataURL();
var imgFileSizeii = Math.round((data_urlii.length)) ;
previousImgFileSize=imgFileSizeii;
console.log(previousImgFileSize);

//Second Image
var data_url;
var imgFileSize;

function testa() {
// Add length and keep updating    
data_url = renderergl.domElement.toDataURL();
imgFileSize = Math.round((data_url.length)) ;
var logit = console.log(imgFileSize);
}


setInterval(function(){ 
var imgFileSizeCh = imgFileSize;
var previmg = previousImgFileSize;

//If second image is bigger than the first do the below
if (imgFileSizeCh =! previmg){

   $('body').css('display','none');
   console.clear();

   } }, 1000);

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire