famo.us animate state of Surfaces in a GridLayout with a StateModifier -



famo.us animate state of Surfaces in a GridLayout with a StateModifier -

how can attach statemodifier surface resides in gridlayout?

my code looks this:

//... var grid = new gridlayout({dimensions: [2,1]}); var surfaces = []; grid.sequencefrom(surfaces); var surface01 = new surface({content: 'surface 01'}); var surface02 = new surface({content: 'surface 02'}); surfaces.push(surface01,surface02); this._node.add(grid); //...

since surfaces not added render tree explicitly like:

this._node.add(modifier).add(surface)

i don't know how can attach modifiers surfaces?! missing something? help much appreciated

you need add together view sequence items. illustration code below uses rendernode view item , adds statemodifier , surface

example jsbin code [v0.3.0 of famo.us]

class="lang-js prettyprint-override"> var maincontext = engine.createcontext(); var surfaces = []; var grid = new gridlayout({ dimensions: [2, 1] }); var counter = 0; _getview = function(name) { var rnode = new rendernode(); var state = new statemodifier({ size: [undefined, 500] }); var surface = new surface({ content:name, properties: { backgroundcolor: "hsl(" + (counter * 360 / 8) + ", 100%, 50%)", lineheight: '500px', textalign: 'center', cursor: 'pointer' } }); rnode.add(state).add(surface); counter += 1; homecoming rnode; }; surfaces.push(_getview('surface 1')); surfaces.push(_getview('surface 2')); grid.sequencefrom(surfaces); maincontext.add(grid);

famo.us

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -