SpriteStage ignoring transforms
See original GitHub issueHi!
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:
- Created 8 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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!
@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?