Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
Why wont this function work in JavaScript

I am working on a small project. The page is supposed to come in from being blurred, into a clear image. The problem is that the image never gets clear. It remains at the same level of blur (30Px). Everything else is now functioning properly.

Im not sure what else to add to the question.


CSS:

@import url('https://fonts.googleapis.com/css?family=Ubuntu');

* {
    box-sizing: border-box;
}

body {
    font-family: "Ubuntu", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    margin: 0;  
}

.bg {
    background: url("4.jpg") no-repeat center center/cover;
    position: absolute;
    top: -300px;
    left: -30px;
    width: calc(100vw + 50px);
    height: calc(100vw + 30px);
    z-index: -1; 
    filter: blur(30px);
}


#text {
    font-size: 50px;
    color: #fff;
}

JS:


loadText = document.getElementById('text');
const bg = document.querySelector('.bg');

let load = 0;

const int = setInterval(blurring, 100);

function blurring() {
    load++
    console.log(load)
    if (load > 99) {
        clearInterval(int)
    }

    loadText.innerText = `${load}%`
    loadText.style.opacity = scale(load, 0, 100, 1, 0)

}

function scale (number, inMin, inMax, outMin, outMax) {
    return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}

blurring()


The image starts blurred, but never becomes clear. This count from 0% to 100% functions properly. The opacity fade is working properly as well. The only thing not functioning is the image becoming clear. 
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda