Skip to content

mathbox / threestrap options #24

@ChristopherChudzicki

Description

@ChristopherChudzicki

Goal: decide how mathbox-react should mediate interactions with mathBox/Threestrap options.

My understanding of mathBox/Threestrap options.

The options passed to const mathbox = mathBox(options) are passd directly to Threestrap, so really this is a discussion of mathbox-react's API for interacting with Threestrap options.

The Threestrap options are generally of the form { plugins: string[], ...pluginOptions }. In general, plugins have options and an API with methods and properties. For example, the loop plugin has:

  • options:

    {
      start: boolean, // whether to start the render loop on initialization
      each: number    // render every nth frame 
    }`
    
  • API

    {
      // methods:
      stop(): void, // stop the render loop
      start: void,  // stop the render loop
      get(): void   // get current options
      set(options): // set new options
    
      // properties:
      each: number    // render every nth frame 
    }`
    

Observations:

  1. Some options only affect initialization behavvior: For the Loop plugin, updating the start option doesn't really make sense because the start option is specifically "start the loop on initialization". It only affects the initialization behavior. Several other plugins have initialization options like this. In contrast, updating the each option DOES make sense.

  2. Some options don't actually work: In particular, the "each" option on Loop does not actually work at the moment. (And in an alternate timeline it was renamed "rate").

  3. See animation loop pause / slowdown? #19 (comment).

  4. Some options work, but can't be updated: I'm not 100% sure about this, but I suspect that there are some options (Camera may be one) that function correctly at initialization (e.g., perspective vs orthographic) but then can't be updated without re-initialization.

    (I'm not sure that mathbox wroks with orthographic cameras anyway, I would really like it to!)

Questions

  1. Should mathbox-react do full re-render when options are updated?
  2. Should mathbox-react provide a declartive interface for interacting with the Threestrap plugin "APIs"? For example, should there be a declarative way to start/stop the render loop?

See also discussion in #20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions