Request : Please make the Behaviour class public
See original GitHub issueCurrent behavior
The Behaviour class is not accessible from the public. And the Behaviour class cannot be extended.
Expected behavior
The Behaviour class is accessible from the public.
Motivation / Use Case
Third party developers will be able to create custom behaviors.
Background
Currently, the Color behavior in three-nebula has two variables, ColorA and ColorB.
I want to set the transparency to a more granular level. For this reason, I have prototyped a custom behavior with the color of the Canvas element as a variable.
https://github.com/MasatoMakino/three-nebula-behaviour-plugin https://masatomakino.github.io/three-nebula-behaviour-plugin/demo/
This is a color behavior with canvas elements and png images as variables.
This prototype works in 5.1.0 and does not work in 5.1.1.
Why it doesn’t work
This prototype is a custom class that extends the Behavior class in the src directory.
From this commit, the src folder has been removed from the npm package.
That’s why I can’t extend the Behavior class from src/behaviour/Behaviour.js
.
Additional information
If getEasingByName() and SUPPORTED_JSON_BEHAVIOUR_TYPES are public, third party developers can customize the fromJson()
function.
However, the public SUPPORTED_JSON_BEHAVIOUR_TYPES has a Side effects. If the behavior has a duplicate TYPE
, fromJson will not work. You can’t limit what TYPE
to third party developers.
I’ve thought of several ideas. They are not the best, but I hope they will help you.
- keep SUPPORTED_JSON_BEHAVIOUR_TYPES private.
- make the function for registering TYPE.
Environment
macOS 10.15.2 three-nebula 5.1.0 - 5.1.1 webpack 4.43.0
Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top GitHub Comments
@cjsjy123 yes, the editor is what is holding up the release a bit, I want the editor to be available at this time. I’ve made the change and committed it to the develop branch in #100 please wait a tiny bit longer, it’ll be out in master soon!
Really soon please wait a little longer!