Copy link to clipboard
Copied
Hello,
My name is Dalal and I need help in my project, in my project there is a hologram control panel and in that panel is a clock from sec to hours, I followed a tutorial on youtube of how to animate and code sec and mins but not hours I need help in coding hours the time starts from 7:30 AM to 5 PM.
Here is what I coded:
slider=effect("Slider Control")("Slider");
sec = slider%60;
min = Math.floor(slider/60);
function addZero(n){
if(n<10) return"0"+n else return n;
}
if(slider>0) {
addZero(min)+":"+ addZero(sec)
}else{
"00:00"
}
Copy link to clipboard
Copied
Try this:
slider=effect("Slider Control")("Slider");
s = Math.floor(slider%86400);
hr = Math.floor(s/3600);
min = Math.floor((s%3600)/60);
sec = Math.floor(s%60);
function addZero(n){
return (n<10 ? "0" : "") + n;
}
str = addZero (hr) + ":" + addZero(min) + ":" + addZero(sec);
str + (s < 43200 ? " AM" : " PM")
Dan
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more