0.3.6 • Published 3 months ago

@iak-extra/scene-composer-extra v0.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

IoT App Kit Extra

>> README - 日本語版

This library extends the AWS IoT App Kit's Scene Composer.

npm.io

npm.io

  • Replaces TwinMaker tag objects to Three.js object (e.g. MMD, buttons, text, etc.)
  • Triggers a color change in TwinMaker tags to change the motion of the MMD and the content of the text.

Strongly dependent on IoT App Kit.

https://github.com/awslabs/iot-app-kit

Dynamic Sample

https://pub-5e7ce27e493044a6ad7b1d927d05320c.r2.dev/index.html

Document

https://shotaoki.github.io/iot-app-kit-extra/

Concept

Easily achieve a range of things that TwinMaker does not implement.

Requirements

Equivalent to IoT App Kit.

Language, Environment

  • Node.js
  • React 18.0 Later
  • Typescript
  • VSCode

Usage

Quick Start

Create new react application with iot-extra.

npx @iak-extra/cli create ${Application Name}

Installation

Already exists react project, you can install with NPM.

npm install @iak-extra/scene-composer-extra

Create Tag

Create tags in TwinMaker in advance.

You can name the tag anything you like. For example, you can name it "any-text-tag-name".

npm.io

Use it

Simply write the following to replace the tag with the name "any-text-tag-name" with a ThreeMeshUi text object.

import { initialize } from "@iot-app-kit/source-iottwinmaker";
import { SceneViewer } from "@iot-app-kit/scene-composer";
import { useOverrideTags } from "@iak-extra/scene-composer-extra";

function App() {
  // Read TwinMaker Scene
  const twinmaker = initialize(/** Certificate */);
  const sceneLoader = twinmaker.s3SceneLoader(/** Scene Info */);

  /** Controller for TwinMaker */
  const controller = useOverrideTags({
    // Replace Tag to Text
    "any-text-tag-name": (replaceTag) =>
      replaceTag.toText?.create({
        content: "TextContents",
      }),
  });

  return (
    <div className="App">
      <SceneViewer
        sceneComposerId={controller.composerId}
        sceneLoader={sceneLoader}
      />
    </div>
  );
}

export default App;

Similarly, the tag is replaced by MMD when written as follows.

"any-mmd-tag-name": (replaceTag) => {
    replaceTag.toMMD?.create({
        // MMD Initialize Info
    })
}

The following will replace the tag with a button.

"any-button-tag-name": (replaceTag) => {
    replaceTag.toButton?.create({
        // Button Initialize Info
    })
    .onClickEvent(() => {
      console.log("clicked !!");
    }),
}

Development

Execute the following command to install the library.

# Execute Directory :: src/scene_composer_extra
npm install

Build the library with the following command.

# Execute Directory :: src/scene_composer_extra
npm run build

# Export To :: package/scene_composer_extra/dist

The following command will import the library into your development project.

npm install ${ProjectRoot}/package/scene_composer_extra

The following command pushes to NPM.

# Execute Directory :: package/scene_composer_extra
npm publish ./

License

The license of this source code is MIT.

The fonts, illustrations, and MMD models included in the resource are the property of their copyright holders and are subject to their licenses.

0.3.6

3 months ago

0.3.5

5 months ago

0.3.3

5 months ago

0.3.2

6 months ago

0.3.1

6 months ago

0.3.0

6 months ago

0.2.9

7 months ago

0.2.8

7 months ago

0.2.7

7 months ago

0.2.6

7 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago