How to use the spritejs.Scene function in spritejs

To help you get started, we’ve selected a few spritejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spritejs / q-charts / src / core / chart / Plot.js View on Github external
if (!isWeixinApp() && opts.forceFit) {
      opts.viewport = 'auto'
    } else {
      opts.viewport = opts.size ? opts.size : [opts.width, opts.height]
    }

    /**
      {
        vwr: 1,
        layer: 'fglayer',
      }
     */
    if (isWeixinApp()) {
      let [width, height] = opts.viewport;
      let pixelRatio = opts.pixelRatio || 'px';
      this.scene = new Scene(Number(width) || null, Number(height) || null, pixelRatio);
    } else {
      this.scene = new Scene(container, {
        displayRatio: 'auto',
        ...opts
      })
    }
    const layerID = opts.layer || 'default'
    if (isWeixinApp()) {
      this.layer = this.scene.layer(layerID, opts.component)
    } else {
      this.layer = this.scene.layer(layerID)
    }

    if (isDev) {
      this.layer.on('update', debounce(() => {
        console.info(
github spritejs / q-charts / src / core / chart / Plot.js View on Github external
} else {
      opts.viewport = opts.size ? opts.size : [opts.width, opts.height]
    }

    /**
      {
        vwr: 1,
        layer: 'fglayer',
      }
     */
    if (isWeixinApp()) {
      let [width, height] = opts.viewport;
      let pixelRatio = opts.pixelRatio || 'px';
      this.scene = new Scene(Number(width) || null, Number(height) || null, pixelRatio);
    } else {
      this.scene = new Scene(container, {
        displayRatio: 'auto',
        ...opts
      })
    }
    const layerID = opts.layer || 'default'
    if (isWeixinApp()) {
      this.layer = this.scene.layer(layerID, opts.component)
    } else {
      this.layer = this.scene.layer(layerID)
    }

    if (isDev) {
      this.layer.on('update', debounce(() => {
        console.info(
          `%c如果持续打印该信息,说明 layer 在不断重绘,需要找出问题!`,
          'color: red'
github spritejs / sprite-react / src / Scene.js View on Github external
componentDidMount() {
    this._scene = new Scene(this.refs.scene, this.props);
    this._mountNode = SpriteRender.createContainer(this._scene);
    SpriteRender.updateContainer(this.props.children, this._mountNode, this);
  }
github Tencent / omi / packages / omi-sprite / src / index.js View on Github external
installed() {
    if(this.shadowRoot && this.shadowRoot.styleSheets) {
      stylesheet.fromDocumentCSS(this.shadowRoot.styleSheets)
    }
    let node = this
    while(node) {
      const styleSheets = node.styleSheets
      if(styleSheets) {
        stylesheet.fromDocumentCSS(styleSheets)
      }
      node = node.parentNode
    }
    this.scene = new Scene(this.container, this.props)
    render(this.scene, this.props.children)
  }