Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8894449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:29:58+00:00 2026-06-14T23:29:58+00:00

My Html Code: <body onload= main() bgcolor=white> <div> <label id=3dobjects>test</label> </br> <canvas id=theCanvas width=720

  • 0

My Html Code:

<body onload= "main()" bgcolor="white">
        <div>
        <label id="3dobjects">test</label>
        </br>
        <canvas id="theCanvas" width="720" height="405">
        </canvas>
        </br>
        <label id="fpsout"></label>
        </div>  
</body>

My SceneJS Script:

<script type="text/javascript">
         var N=10;
         function average(v){
             var items = v.length;
             var sum = 0.0;
             for (i = 0; i<items; i++)
             sum += v[i];
             return (sum/items);
           }

         function main()
         {


          SceneJS.createScene({
          type: "scene",
          id: "theScene",
          canvasId: "theCanvas",
          nodes: [{
            type:"library",
              id:"mylib",
              nodes:[]
            },
            // Viewing transform specifies eye position, looking at the origin by default
            {
              id:"lookat",
              type: "lookAt",
              eye : { x: 0.0, y: 1.0, z: 80.0 },
              up : { z: 1.0 },
              look:{x:0,y:0,z:0},
              nodes: [
                  /* Camera describes the projection*/
                  {
                type: "camera",
                optics: {
                type: "perspective",
                fovy : 45.0,
                aspect : 1.78,
                near : 0.10,
                far : 300.0
                  },
               nodes: [
                       {
                           type: "renderer",
                           clearColor: { r: 0.0, g: 0.0, b: 0.0 },
                           clear: {
                               depth : true,
                               color : true
                       },

                  nodes: [
                      // Light Source
                      {
                    type: "light",
                    mode:                   "point",
                    color:                  { r: 1.0, g: 1.0, b: 1.0 },
                    diffuse:                true,
                    specular:               true,
                    pos:{ x: 10.0, y: 10.0, z: 10.0 }
                    },

                     // Tranform
                      {
                    type: "rotate",
                    id: "pitch",
                    angle: 0.0,
                    x : 1.0,    
                    nodes: [
                        {
                          type: "rotate",
                          id: "yaw",
                          angle: 0.0,
                          y : 1.0,
                          nodes: [       
                              // Lights Properties
                              {
                                type: "material",
                                id:"cubeviewspace",
                                emit: 0.1,
                                  baseColor:      { r: 0.8, g: 0.8, b: 0.8 },
                                  specularColor:  { r: 0.8, g: 0.8, b: 0.8 },
                                  specular:       0.7,
                                  shine:          10.0
                              }
                              ]
                            }
                        ]
                      }
                      ]
                       }
                       ]
                  }
                  ]
            }
            ]
        });
         var scene = SceneJS.scene(theScene);
         for(var i=0; i<N; i++){
           scene.findNode("cubeviewspace").add("node",{
          type:"translate",
            id:"balltrans"+i,
            x:(Math.random()-0.5) * scale,
            y:(Math.random()-0.5) * scale,
            z:(Math.random()-0.5) * scale,
            nodes:[{
              type: "cube",
            id: "ball"+i
            }]
            });
         }  
         // Printing Number Of Cubes
         document.getElementById('3dobjects').innerHTML = "The number of Cube Objects: " +N;
         var t0 = (new Date()).getTime();
         var t = 0;

         var fpss = [];
         scene.start({
        idleFunc:function(){
          var t1 = (new Date()).getTime();
          fpss.push(1000/(t1 - t0));
          if(fpss.length>200)
            fpss.shift();
          // Printing fps 
          document.getElementById('fpsout').innerHTML = "The number of Cube Objects: " +average(fpss);
          t0 = t1;
          t++;
        }
           });
     }

</script>

First of all sorry, If I avoid any rules for posting this question. My intention was to get the solution for the problem but nothing else. SceneJS API is very new to my kind of programming, yet I’m trying to code my best. I was trying to print cubes all over the space and also calculate the corresponding FPS. I couldn’t see even canvas on the screen but only just empty browser. I have been trying different sorts of ways(almost edited previous version completely)to fix it, but my effort going vain. I request if someone help me in this issue. I’m seriously thankful for the person.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:29:59+00:00Added an answer on June 14, 2026 at 11:29 pm

    You have to change the below code

    var scene = SceneJS.scene(theScene);
    

    to

    var scene = SceneJS.scene("theScene");
    

    add “ either side of scene id.

    And add

    var scale = any_value_you_want;
    

    you omits “scale” variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following html code. <html> <body> <div style=max-width:1600px; min-width:900px; > <table> </table>
The code is as below: <html> <head> <title>test</title> </head> <body> <div><span>shanghai</span><span class=margin> </span><span>male</span></div> </body>
This is my code: index.html: ... <script type=text/javascript charset=utf-8 src=main.js></script> </head> <body onload=init();></body> ...
I'm trying to generate the following html code using cl-who: <html> <body> <div id=cnt_1></div>
What am I doing wrong in this HTML code: <html> <head> </head> <body> <div
Consider the following code: $(document).ready(function() { $(body).append(<div class='outer'><span class='inner'>Click me</span></div>); $(html).click(function(event) { var targetClass
Here is my code html> <head></head> <body> <?php $dir = 'folder/'; $files = scandir($dir);
I've a simple html page with no code in the body tag. I want
I have the following html and css code: <!DOCTYPE HTML> <html> <head> </head> <body>
HTML <body> <form id=form1 runat=server> <asp:Button runat=server ID=a OnClick=a_Click Text=apd/> </form> </body> Code protected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.