Pure jquery:
const window = $(window);
const logo = $('.logo');
window.scroll(function(){
if( window.scrollTop < 100 )
logo.attr('src', 'logooficial.png')
else
logo.attr('src', 'logooficial2.png')
});
Or Voce can also do with the help of css
<style>
.logo {
background: url('logooficial.png')
}
.logo.scrolled {
background: url('logooficial2.png')
}
</style>
<script>
const window = $(window);
const logo = $('.logo');
window.scroll(function(){
if( window.scrollTop < 100 )
logo.removeClass('.scrolled')
else
logo.addClass('.scrolled')
});
</script>
In this second case, the image should not be set with the tag but with a div and the background image with css
my code in the menu pro script is already like this
$(window).on("scroll", function() {
 if($(window).scrollTop()) {
 $('nav').addClass('black');
 }

 else {
 $('nav').removeClass('black');
 }
 })
how would you add that you said ? thanks already =) ta helping mt men– lincoln ferreira

const logo = $('.logo');
$(window).on("scroll", function() { 
 if($(window).scrollTop()) { 
 logo.attr('src', 'logooficial.png');
 $('nav').addClass('black'); 
 } else {
 logo.attr('src', 'logooficial2.png');
 $('nav').removeClass('black'); 
 } 
})
I believe I would add so.– Robson Braga