Skip to content

Conversation

@marklundin
Copy link
Collaborator

@marklundin marklundin commented Sep 17, 2024

Updates all tutorials to include both Classic and ESM versions of code examples.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

marklundin and others added 30 commits March 27, 2024 12:28
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
marklundin and others added 2 commits June 18, 2025 14:23
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds ESM (ES Modules) versions of all tutorial code examples alongside the existing Classic scripts by wrapping them in <Tabs> and <TabItem> components.

  • Introduced ESM code snippets for each tutorial using PlayCanvas’s new module API.
  • Wrapped legacy Classic examples in corresponding <TabItem> blocks for side-by-side comparisons.
  • Ensured each tutorial markdown file includes the necessary imports and closing tags for the new tabbed layout.

Reviewed Changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/tutorials/music-visualizer.md Wrapped analyser and visualizer scripts in Tabs; added ESM versions.
docs/tutorials/mouse-input.md Added ESM version of mouse input example and Tabs.
docs/tutorials/more-cameras.md Added ESM zoom and camera manager code with Tabs.
docs/tutorials/loading-json.md Added ESM game script example inside Tabs.
docs/tutorials/light-halos.md Wrapped halo script examples in Tabs with ESM.
docs/tutorials/keyboard-input.md Introduced ESM keyboard handler and Tabs.
docs/tutorials/keepyup-part-three.md Added ESM Game and Input scripts for KeepyUp part three.
docs/tutorials/keepyup-part-six.md Inserted ESM UiMenu example in part six.
docs/tutorials/keepyup-part-four.md Wrapped ESM Ball script for part four.
docs/tutorials/google-ads-for-games.md Added ESM UiController example with Tabs.
docs/tutorials/first-person-movement.md Introduced full ESM FPS movement code in Tabs.
docs/tutorials/facebook-api.md Wrapped FbUi and FacePhoto ESM examples in Tabs.
docs/tutorials/entity-picking.md Added ESM raycast and framebuffer picker code in Tabs.
docs/tutorials/custom-shaders.md Wrapped ESM CustomShader examples in Tabs.
docs/tutorials/custom-posteffect.md Added ESM WaterColor post-effect example.
docs/tutorials/controlling-lights.md Wrapped LightHandler ESM example in Tabs.
docs/tutorials/collision-and-triggers.md Added ESM Trigger and Collider scripts in Tabs.
docs/tutorials/animation-blending.md Wrapped ESM AnimationBlending code in Tabs.
docs/tutorials/anim-blending.md Added ESM KeyboardControls example in Tabs.
docs/tutorials/Using-forces-on-rigid-bodies.md Introduced ESM Movement script in Tabs.
Comments suppressed due to low confidence (3)

docs/tutorials/entity-picking.md:41

  • [nitpick] The scriptName casing (pickerRayCast) differs from the Classic version (pickerRaycast); update to match the existing registration.
    static scriptName = "pickerRayCast";

docs/tutorials/music-visualizer.md:156

  • Duplicated .analyser.analyser chain is incorrect; you should access minDecibels directly on the analyser node (e.g., this.analyser.script.analyser.minDecibels).
        this.minDb = this.analyser.script.analyser.analyser.minDecibels;

docs/tutorials/music-visualizer.md:157

  • Similar to minDecibels, drop the extra .analyser and use this.analyser.script.analyser.maxDecibels directly.
        this.maxDb = this.analyser.script.analyser.analyser.maxDecibels;

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@willeastcott willeastcott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@marklundin marklundin merged commit 70cfe2a into main Jun 23, 2025
2 checks passed
@marklundin marklundin deleted the feat-esm-tutorials branch June 23, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants