LordThrembo
2024 oldGOD
svvt please come back
Java won
Where is C? Recently I been playing with C23 and it's so fun to work with.first thread of /tech/ but also talk about programming in languages such as
- C++
- Javascript
- Python
- Go
- Rust (trans btw)
- Ada
- Fortran
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;
}
}
<span id="test"> this text is supposed to fade in and out </span>
o algoUsed gemini a few times, spouted nonfunctioning dust every timeChatGPT mogs all of you albeit.
try CoPilot it should be better since it's specifically for programmingUsed gemini a few times, spouted nonfunctioning dust every time
May have to try gpt instead
relatableView attachment 46699
>SAAAAR YOU NEED TO USE MY EXACT JAVA VERSION THAT HAS 20 DIFFERENT DISTRIBUTIONS FOR THE PROGRAM TO WORK
>BUILD FAILED
i learnt more without pursuing it in education geg, fucking python... GEEEEEG.i took 1 year of computer science.
we learned python.
Probably not the worst thing I have ever seen, but still pretty bad. You are aware this can be done purely in CSS right?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
@keyframes fade {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#test {
animation: fade 5s infinite;
}
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)Probably not the worst thing I have ever seen, but still pretty bad. You are aware this can be done purely in CSS right?
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 thisView attachment 49006Code:@keyframes fade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } } #test { animation: fade 5s infinite; }
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.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
it was either that or fucking dance class.i learnt more without pursuing it in education geg, fucking python... GEEEEEG.
Apparently the website was only supposed to use html and css anyways there wouldn't have been any point in using it kekI 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.