Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: guides components containers masking code sample #129

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/guides/components/containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Think of a pop-up window. It has a frame made of one or more Sprites, then has
```ts
// Create the application helper and add its render target to the page
let app = new Application({ width: 640, height: 360 });

// Initialize the application
await app.init({ resizeTo: window });

document.body.appendChild(app.view);

// Create window frame
Expand Down Expand Up @@ -68,7 +72,9 @@ maskContainer.position.set(4,4);
frame.addChild(maskContainer);

// Create contents for the masked container
let text = new Text({
//
// First, create a text texture
let textTexture = app.renderer.canvasText.getTexture({
text:'This text will scroll up and be masked, so you can see how masking works. Lorem ipsum and all that.\n\n' +
'You can put anything in the container and it will be masked!',
style:{
Expand All @@ -80,6 +86,9 @@ let text = new Text({
x:10
});

// Then, create a Sprite from the text texture
const text = new Sprite(textTexture);

maskContainer.addChild(text);

// Add a ticker callback to scroll the text up and down
Expand Down