64587187

Date: 2020-10-29 08:15:55
Score: 8.5
Natty:
Report link

Have you solved the problem yet? I have also encountered this problem. If you have solved it, how did you solve it?

here is my code, I rendered a cube without the line code:"cube.texture.file = 'http://x.babymri.org/?xtk.png';"

But when I add this line of code, I get an error "Uncaught TypeError: fa.setTimeout is not a function".

Here is my reference code "https://github.com/xtk/lessons/blob/gh-pages/01/demo.js", and it runs well

enter image description here

import React from "react";
import "./XtkViewer.css"
import * as XTK from "xtk"


class XtkViewer extends React.Component{
    constructor(props) {
        super(props);
        this.state = {};
    }
    componentDidMount() {
        this.initXtk()
    }

    initXtk() {
        // create and initialize a 3D renderer
        let r = new XTK.X.renderer3D();
        r.container = "XtkViewer"
        r.init();

        // create a cube
        let cube = new XTK.X.cube();
        // skin it error
        cube.texture.file = 'http://x.babymri.org/?xtk.png';
        // window.console.log(cube)

        // setting the edge length can also be skipped since 20 is the default
        cube.lengthX = cube.lengthY = cube.lengthZ = 20;

        // can also be skipped since [0,0,0] is the default center
        cube.center = [0, 0, 0];

        // [1,1,1] (== white) is also the default so this can be skipped aswell
        cube.color = [1, 1, 1];

        r.add(cube); // add the cube to the renderer
        r.render(); // ..and render it

        // add some animation
        // r.onRender = () => {
        //   cube.transform.rotateX(1)
        //   cube.transform.rotateY(1)
        // }
    }

    render() {
        return (
            <div className="XtkViewer" id="XtkViewer">Longer King</div>
        )
    }
}

export default XtkViewer
Reasons:
  • Blacklisted phrase (1): thx
  • Blacklisted phrase (1): how did you solve it
  • Blacklisted phrase (1.5): have you solved the problem
  • RegEx Blacklisted phrase (2): did you solve it
  • RegEx Blacklisted phrase (1.5): solved the problem yet?
  • RegEx Blacklisted phrase (1.5): solve it?
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: longerking