AnsweredAssumed Answered

Set realistic environment settings in a SceneView sample code

Question asked by mshukun1 on Apr 27, 2017
Latest reply on Apr 28, 2017 by mshukun1

I would like to show and hide the tool using a button, but I haven't been able to make it work.  The image below displays the problems that I encountered.  The first problem is I am not sure how to reset environment setting (removing shadow),  and the second problem is how to make the clock to work (getting local time and also shadow casting).  I would appreciate your assistance.

 

 

    var clock = new Clock({
        el: "clock",
        skin: require.toUrl('./third-party/clock.svg'),
        time: sceneView.environment.lighting.date.getTime()
    });
    sceneView.ui.add('clock', 'bottom-right');
   
    clock.on('time-change', function(time) {
        sceneView.environment.lighting.date = time;
        sceneView.environment.lighting.directShadowsEnabled = true;
    });

    $('#shadow').on('click', function(){
      var display = $('#clock').css('display');
      if (display == 'block') {
        $('#clock').css('display', 'none');
        // Show shadow with clock;
        sceneView.ui.add('clock', 'bottom-right');
      } else {
        $('#clock').css('display', 'block');
        // Hide shadow and clock
        sceneView.ui.remove(clock);
      }
    })

Outcomes