Welcome to Lagoa Support Forum API Very simple application without Lagoa iframes

This topic contains 3 replies, has 3 voices, and was last updated by  Dov Amihod 2 years, 11 months ago.

  • Author
    Posts
  • #3092

    Baris Saricoglu
    Participant

    Hello,

    I’m very impressed with the quality and the speed of the renderings.
    But I’m not sure if Lagoa answers to my specific needs.
    All samples load a WebGL application in a chain of iframe.
    The problem is this ‘pro interface’ will scare the end user.
    Perhaps I’m asking too much but is it possible to make something like this ? :

    <html>
    [...]
    
    <img id="lagoa" src="pleaseWaitImage.jpg" />
    <button id="button1">Change Color</button>
    <button id="button2">Toggle Visibility</button>
    
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="lapi.js"></script>
    <script>
    $(function() {
    
      // Replace the image content with a Lagoa render
      $('#lagoa')
       .lagoa()
       .loadScene(mySceneId, myToken);
       .renderUntil(qualityLevel);
    
      // Interact with the scene, for example change the color of a material...
      $('#button1').click(function() {
        Lagoa
         .getActiveScene()
         .getMaterialById(myMaterialId)
         .getLayerByName(myColorLayer)
         .setColor('#FF0000');
      }
    
      $('#button2').click(function() {
        var myItem = Lagoa
         .getActiveScene()
         .getItemById(myItemId);
    
        myItem.visibility = !myItem.visibility;
      }
    
    </script>
    
    [...]
    </html>
  • #3095

    Thiago Costa
    Keymaster

    I am not sure what you mean by pro interface? The Embeds should only have a simple toolbar in the bottom with the viewing controls…
    are you talking about the fact that renders are grainy while they are progressing?

    Your code is sound, you would have to hide the frame and just show it when it is “ready” to display. That said we may want to add some native functionality to do this… but you can most certainly build a prototype today.

  • #3096

    Thiago Costa
    Keymaster

    In fact… I just re-read your question. There is also the option of not even loading any iFrames and rendering it offscreen. This is something you would need to get in touch with support to get an API key if you are building a project that requires this feature.

  • #3218

    Dov Amihod
    Keymaster

    Hi Baris,

    You should be able to accomplish what you’re looking for with Lagoa’s client API. Take a look at the walkthrough we’ve published here http://support.lagoa.com/getting-started-api/ which describes step-by-step how to get there.

    Dov

You must be logged in to reply to this topic.