void TutorialApp::makeNode() { #if defined( CINDER_COCOA_TOUCH ) const float dMax = 220.0f; const float d = randFloat( 28.0f, dMax ); float r = 11.0f; #else const float dMax = 400.0f; const float d = randFloat( 50.0f, dMax ); float r = 20.0f; #endif r += ( 1.0f - ( d / dMax ) ) * r * 2.0f; UiTree& node = mUiTree.createAndReturnChild() .collisionType( UiTree::CollisionType_Circle ) .data( UiData() .color( randColor() ) .distance( d ) .speed( randFloat( -1.0f, 1.0f ) ) ) .enable() .scale( vec2( r ) ); /* * To improve performance and stability of your app */ mIdBatchMap[ node.getId() ] = randBatch(); /* * While inline anonymous functions are useful for * quick sketching, it's better to use an event handler * instance for callbacks. It routes everything back into * fewer places and helps organize your code. */ mEventHandler.connect( node ); }