Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

time code and expressions HELP

New Here ,
Nov 04, 2018 Nov 04, 2018

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"

}

TOPICS
Expressions
10.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 04, 2018 Nov 04, 2018
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines