index

Übersicht: Blend4Web


UseCase

  1. create a timestamp
  2. divide the time into parts of seconds, minutes and hours
  3. save true or false for each Element
  4. color the clock elements
function load_cb(data_id, success) {

 if (!success) {
     console.log("b4w load failure");
     return;
 }

 m_app.enable_camera_controls();

 // place your code here

 myclock();

}

Underneath of the function load_cb create your own code. Create two new functions myclock and getTimeStamp at the beginning:

function myclock () {

  // coloring all parts of the clock for a timestamp
  var ts = getTimeStamp ();
  console.log('myclock called');
}

function getTimeStamp (){

  // get all parts of the actual time

  console.log('getTimestamp called');
}

The function myclock is calling getTimeStamp, don't forget to add myclock() in the function load_cb (see also the comment)

Start the file in the browser...

/blend4web/berlin-clock/bc-run-app.png

... and open the developer console...

/blend4web/berlin-clock/bc-browser-debug.png

... you now should see the output of console.log.

Comments