question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SpriteStage ignoring transforms

See original GitHub issue

Hi!

As of 0.8.1, SpriteStage ignores any transforms (translate, scale etc) applied directly to the stage, even though the docs don’t mention any such restrictions. This is especially inconvenient if you want to combine Sprites and Bitmaps, since arbitrary Bitmaps can only be added direcly to the SpriteStage, not to SpriteContainers (and regular Containers aren’t allowed for SpriteStages). I wanted to implement panning and zoom for my whole scene, hence why I tried transforming my Stage.

Had a look at the source and it was pretty easy to enable transforms for the SpriteStage:

Change

p._drawWebGLKids = function(kids, ctx, parentMVMatrix) {

            [...]

            // Get the kid's global matrix (relative to the stage):
            mtx = (parentMVMatrix ? mtx.copy(parentMVMatrix) : mtx.identity()).appendTransform(kid.x, kid.y, kid.scaleX, kid.scaleY, kid.rotation, kid.skewX, kid.skewY, kid.regX, kid.regY);

}

to

p._drawWebGLKids = function(kids, ctx, parentMVMatrix) {

            [...]

            if(!parentMVMatrix) {
                mtx = new createjs.Matrix2D().identity().appendTransform(this.x, this.y, this.scaleX, this.scaleY, this.rotation, this.skewX, this.skewY, this.regX, this.regY);
            } else {
                mtx = mtx.copy(parentMVMatrix);
            }

            // Get the kid's global matrix (relative to the stage):
            mtx = mtx.appendTransform(kid.x, kid.y, kid.scaleX, kid.scaleY, kid.rotation, kid.skewX, kid.skewY, kid.regX, kid.regY);
}

Is there any reason why this is omitted? Code comments suggest this was intentional, but I can’t see why.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lannymcniecommented, Feb 22, 2017

@Cleod9 That is great to hear!

We are planning some polish and release in the next 2 weeks. We will post updates to the CreateJS blog and twitter.

Cheers!

0reactions
Cleod9commented, Feb 22, 2017

@lannymcnie Just stumbled upon this StageGL mention, phenomenal work for a beta branch! This is a huge improvement over the limitations of SpriteContainer/SpriteStage. I plugged it into a 1920x1080 CreateJS canvas game we’re developing and it’s basically addressed of all of our performance woes without issue. Is there a recommended place I can follow along with news/updates on StageGL?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ignore true for transform map - ServiceNow Community
Once the action has been asserted as ignore = true, that row is completely ignored and the transform map process moves to the...
Read more >
EaselJS v1.0.0 API Documentation : StageGL - CreateJS
Each time the tick method is called, the display list is rendered to the target <canvas/> instance, ignoring non-WebGL-compatible display objects. On devices ......
Read more >
openfl.display.DisplayObjectContainer - API Reference
Child display objects belonging to a sandbox to which the excuting code does not have access are ignored. Note: Streaming media playback controlled...
Read more >
Stage - Documentation - LayaBox
... height, and mouseThrough attributes of the object are ignored. ... Sprite#stage ... Converts the global coordinates of stage to local coordinates.
Read more >
DisplayObjectContainer - Adobe ActionScript® 3 (AS3 ) API ...
Inherited, transform : flash.geom:Transform. An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. DisplayObject.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found