These are chat archives for pixijs/pixi.js

28th
Dec 2015
Bar Ziony
@bartzy
Dec 28 2015 09:40
@ivanpopelyshev Sorry for the late reply... Why not use width/height?
@ivanpopelyshev Here is some demo code: https://dl.dropboxusercontent.com/u/24742730/index.html
And mainly at Hole.js which is what extends Container: https://dl.dropboxusercontent.com/u/24742730/Hole.js
It's really ugly but I couldn't find of a way to do it otherwise....
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 09:45
width and height are not cached and they are calculated in getLocalBounds(), and that's evil :)
Bar Ziony
@bartzy
Dec 28 2015 09:51
so what is _width and _height :\
so how do I set the width and height of an element.....?
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 09:52
oh right, you're talking about Sprite.width and height
they're ok :)
but container.width and container.height are evil
so better not to use proto.width and proto.height
you have your own _width and _height for it
and proto's width/height depends on children
Bar Ziony
@bartzy
Dec 28 2015 10:00
I'm talking about container width and height, how can I set them?
It's weird that a container has no width/height by itself :|
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 10:33
ugh, you already made a code for it, just use your _width and _height
before you use Container.width and Container.height look how they work: they are calling getLocalBounds() which calculates rectangle based on children positions
in your case width and height are fixed by you
you overriden them already
Bar Ziony
@bartzy
Dec 28 2015 11:26
yeah that's really ugly
But I didn't find a way to do it otherwise..?
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 13:51
when you are creating container with fixed size (your width/height) you need to override width,height and do your own logic there
default pixi container logic is "to calculate width/height we need local bounds which are calculated based on children bounds in our coordinate system"
position, scale,rotation and texture frame size are first-class citizens in pixi objects. Width and height are calculated. when you change width or height its scale that actually changed
Bar Ziony
@bartzy
Dec 28 2015 14:32
If Pixi would implement something like the iOS view system (in terms of bounds, frame, transformations etc), I think it can really become what famo.us always promised...
Right now I'm really struggling to do basic stuff, even though I can really see the power of the rendering engine itself
Maybe I'm trying to use Pixi for something it wasn't designed for (not a game)
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 14:52
I hope we'll get it right in pixiv4 :)
In your case, I can recommend SVG graphics too. You can make stuff in adobe illustrator and then export it to SVG. Greensock is also good library.
Bar Ziony
@bartzy
Dec 28 2015 15:01
Greensock for animation?
@ivanpopelyshev When pixi v4 is scheduled (rough estimate) for ?
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 15:02
I think summer 2015 :)
Bar Ziony
@bartzy
Dec 28 2015 15:02
@ivanpopelyshev From what I read in the issues it's going to be a very major change? So creating something right now with pixi v3 is a mistake ?
:D
2016?
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 15:03
No, its not mistake. I think v4 will have the same default behaviour but better architecture and more components/containers to work with
*2016
And I hope it will be projects-driven. I'm still preparing it for gameofbombs.com and helping some other projects to move their stuff on it
Bar Ziony
@bartzy
Dec 28 2015 15:10
@ivanpopelyshev How Pixi.js treats transforms? I mean, an object's bounds is twice the size when it is scaled by 2.0 in its transform, for example?
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 15:10
yep
transforms are first-class citizens
everything depends on them
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 15:18
I hope it will be next-gen 2d engine with support of everything from SVG rendering to hardcore shaders stuff
Bar Ziony
@bartzy
Dec 28 2015 15:29
So, for example, you saw what I'm trying to make
a "Hole" object that has a mask, and an image in it.
Am I using Pixi correctly by extending Container like that?
I want to encapsulate a "Hole" behavior inside one object. But it seems that I have to jump through hoops for that.
Bar Ziony
@bartzy
Dec 28 2015 16:45
@ivanpopelyshev ? :)
Ivan Popelyshev
@ivanpopelyshev
Dec 28 2015 16:45
using Container as prototype is totally ok
I do it everytime :)
i dont know why do you need width/height if you can just use scale in that thing and its children