| 63 | } |
| 64 | |
| 65 | void VisualDictionaryApp::layoutWords( vector<string> words, float radius ) |
| 66 | { |
| 67 | int radiusDivisor = 26;//std::max<int>( 10, words.size() ); // don't let the circles get too small |
| 68 | mCurrentCircleRadius = radius / radiusDivisor * M_PI; |
| 69 | for( size_t w = 0; w < words.size(); ++w ) { |
| 70 | int wordLength = words[w].length(); |
| 71 | string s = words[w]; |
| 72 | int charIndex = (int)s[wordLength-1] - 97; |
| 73 | float charPer = charIndex/26.0f; |
| 74 | float angle = charPer * 2.0f * M_PI; |
| 75 | //float angle = w / (float)words.size() * 2 * M_PI; |
| 76 | vec2 pos = getWindowCenter() + radius * vec2( cos( angle ), sin( angle ) ); |
| 77 | Color col( CM_HSV, charPer, 0.875f, 1 ); |
| 78 | mNodes.push_back( WordNode( words[w] ) ); |
| 79 | mNodes.back().mPos = getWindowCenter() + radius * 0.5f * vec2( cos( angle ), sin( angle ) ); |
| 80 | mNodes.back().mColor = ColorA( col, 0.0f ); |
| 81 | mNodes.back().mRadiusDest = mCurrentCircleRadius; |
| 82 | mNodes.back().mRadius = 0; |
| 83 | |
| 84 | timeline().apply( &mNodes.back().mRadius, mNodes.back().mRadiusDest, 0.4f, EaseOutAtan( 10 ) ).timelineEnd( -0.39f ); |
| 85 | timeline().apply( &mNodes.back().mPos, pos, 0.4f, EaseOutAtan( 10 ) ).timelineEnd( -0.39f ); |
| 86 | timeline().apply( &mNodes.back().mColor, ColorA( col, 1.0f ), 0.4f, EaseOutAtan( 10 ) ).timelineEnd( -0.39f ); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void VisualDictionaryApp::setup() |
| 91 | { |
nothing calls this directly
no test coverage detected