protected void init ( ExplodeInfo info , int x , int y , int width , int height ) { _info = info ; _ox = x ; _oy = y ; _owid = width ; _ohei = height ; _info . rvel = ( float ) ( ( 2.0f * Math . PI ) * _info . rvel ) ; _chunkcount = ( _info . xchunk * _info . ychunk ) ; _cxpos = new int [ _chunkcount ] ; _cypos = new int [ _chunkcount ] ; _sxvel = new float [ _chunkcount ] ; _syvel = new float [ _chunkcount ] ; // determine chunk dimensions _cwid = _owid / _info . xchunk ; _chei = _ohei / _info . ychunk ; _hcwid = _cwid / 2 ; _hchei = _chei / 2 ; // initialize all chunks for ( int ii = 0 ; ii < _chunkcount ; ii ++ ) { // initialize chunk position int xpos = ii % _info . xchunk ; int ypos = ii / _info . xchunk ; _cxpos [ ii ] = _ox + ( xpos * _cwid ) ; _cypos [ ii ] = _oy + ( ypos * _chei ) ; // initialize chunk velocity _sxvel [ ii ] = RandomUtil . getFloat ( _info . xvel ) * ( ( xpos < ( _info . xchunk / 2 ) ) ? - 1.0f : 1.0f ) ; _syvel [ ii ] = - ( RandomUtil . getFloat ( _info . yvel ) ) ; } // initialize the chunk rotation angle _angle = 0.0f ; }
Initializes the animation with the attributes of the given explode info object .