Programming Thread

1727519875895.png

>SAAAAR YOU NEED TO USE MY EXACT JAVA VERSION THAT HAS 20 DIFFERENT DISTRIBUTIONS FOR THE PROGRAM TO WORK
>BUILD FAILED
 
Making a website for a school club, I'm also learning html/css/js on the fly pleaze excuse my retardation
I'm trying to make a specific word in the text fade in and out but as previously mentioned js is troonshart nonsense aldough i learned java last year
My javascript:
let word = document.getElementById("test") let opacity = 1; fade(); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function fade() { if (opacity > 0) { opacity -= 0.05; sleep(50); word.style.opacity = opacity; } else if (opacity < 1) { opacity += 0.05; sleep(50); word.style.opacity = opacity; } }
In my html file i have a span tag kinda like
<span id="test"> this text is supposed to fade in and out </span> o algo
Maybe the editor im using is retarded maybe im doing something wrong whatever it is help would be appreciated
 
View attachment 46699
>SAAAAR YOU NEED TO USE MY EXACT JAVA VERSION THAT HAS 20 DIFFERENT DISTRIBUTIONS FOR THE PROGRAM TO WORK
>BUILD FAILED
relatable
i took 1 year of computer science.


we learned python.
i learnt more without pursuing it in education geg, fucking python... GEEEEEG.
Making a website for a school club, I'm also learning html/css/js on the fly pleaze excuse my retardation
I'm trying to make a specific word in the text fade in and out but as previously mentioned js is troonshart nonsense aldough i learned java last year
My javascript:
let word = document.getElementById("test") let opacity = 1; fade(); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function fade() { if (opacity > 0) { opacity -= 0.05; sleep(50); word.style.opacity = opacity; } else if (opacity < 1) { opacity += 0.05; sleep(50); word.style.opacity = opacity; } }
In my html file i have a span tag kinda like
<span id="test"> this text is supposed to fade in and out </span> o algo
Maybe the editor im using is retarded maybe im doing something wrong whatever it is help would be appreciated
Probably not the worst thing I have ever seen, but still pretty bad. You are aware this can be done purely in CSS right?
Code:
@keyframes fade {
  0% {
  opacity: 0;
  }
  50% {
  opacity: 1;
  }
  100% {
  opacity: 0;
  }
}
 
 

#test {
animation: fade 5s infinite;
}
neutralplier2.png
 
Probably not the worst thing I have ever seen, but still pretty bad. You are aware this can be done purely in CSS right?
I was not, i joogled the same question over and over again and every result said do it in js (also all of that code is either from a tutorial online or gemini)
Code:
@keyframes fade {
  0% {
  opacity: 0;
  }
  50% {
  opacity: 1;
  }
  100% {
  opacity: 0;
  }
}
 
 

#test {
animation: fade 5s infinite;
}
View attachment 49006
Found the problem, was using class instead of id. I'll probably end up using the code you sent but I'll try out the stuff I tried with jquery earlier today that wasn't working because I at least want to learn something from this
appreciate the help albeit
 
I was not, i joogled the same question over and over again and every result said do it in js (also all of that code is either from a tutorial online or gemini)

Found the problem, was using class instead of id. I'll probably end up using the code you sent but I'll try out the stuff I tried with jquery earlier today that wasn't working because I at least want to learn something from this
appreciate the help albeit
I usually tend to avoid jquery and external libraries as much as possible IMO. The important thing is knowing what can be done with Javascript, CSS and HTML. HTML is the core of the website, CSS is what makes a website actually look good and JavaScript is to be avoided unless it is absolutely necessary. My personal blog website uses a hexo static page generator, which makes most of it's pages just pure html and CSS, but the splash text uses JavaScript because it has to.

Using Javascript for things like animations, which are visual should be avoided, that is unless you're like me and working on an extension that doesn't have direct access to the website and has to inject things in. Javascript is powerful but it can also be very performance heavy if misused. which is why I always tend to keep track of every for loop I have to make sure I'm not overusing anything like that. But overall, for things like opacity, just use CSS animations. If you want to learn Javascript, try making buttons and tabs or something like that, or maybe a game in javascript, idk.
 
i learnt more without pursuing it in education geg, fucking python... GEEEEEG.
it was either that or fucking dance class.
i thought we could js play games in comp sci o algo.

last time i learned how to dance was when i was a chambelán at a quince.
i ain't taking no chances to doing it again.
it was a disaster, i hated it, and i'm never dancing again.
 
I usually tend to avoid jquery and external libraries as much as possible IMO. The important thing is knowing what can be done with Javascript, CSS and HTML. HTML is the core of the website, CSS is what makes a website actually look good and JavaScript is to be avoided unless it is absolutely necessary. My personal blog website uses a hexo static page generator, which makes most of it's pages just pure html and CSS, but the splash text uses JavaScript because it has to.

Using Javascript for things like animations, which are visual should be avoided, that is unless you're like me and working on an extension that doesn't have direct access to the website and has to inject things in. Javascript is powerful but it can also be very performance heavy if misused. which is why I always tend to keep track of every for loop I have to make sure I'm not overusing anything like that. But overall, for things like opacity, just use CSS animations. If you want to learn Javascript, try making buttons and tabs or something like that, or maybe a game in javascript, idk.
Apparently the website was only supposed to use html and css anyways there wouldn't have been any point in using it kek
Otherwise i get your point, i think js is out of my scope at the moment anyways so I'll work on getting a better grasp on html/css first and then mess with other stuff
 
Back
Top