MCPcopy Create free account
hub / github.com/cinder/Cinder / scatter

Method scatter

samples/_timeline/PaletteBrowser/src/Swatch.cpp:31–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void Swatch::scatter( Timeline &timeline, float width, float height )
32{
33 vec2 pos1( 0.0f, mPos().y );
34 vec2 pos2( 0.0f, height );
35 vec2 pos3 = vec2( Rand::randFloat( width ), Rand::randFloat( height - 50.0f, height + 50.0f ) );//pos2 + rVec;
36
37 float dur = Rand::randFloat( 0.25f, 0.5f );
38
39 // pos
40 timeline.apply( &mPos, mPos(), 0.2f, EaseInAtan( 10 ) ).finishFn( bind( &Swatch::setSelected, this ) );
41 timeline.appendTo( &mPos, pos2, 0.0001f, EaseNone() );
42 timeline.appendTo( &mPos, pos3, dur, EaseOutAtan( 20 ) );
43
44 // alpha
45 timeline.apply( &mAlpha, 0.0f, 0.2f, EaseInAtan( 10 ) );
46 timeline.appendTo( &mAlpha, 1.0f, dur, EaseOutAtan( 10 ) );
47
48 // scale
49 float s = (float)Rand::randInt( 3, 7 );
50 timeline.apply( &mScale, 1.0f, 0.2f, EaseInAtan( 10 ) );
51 timeline.appendTo( &mScale, s*s, dur, EaseOutAtan( 20 ) );
52}
53
54void Swatch::assemble( Timeline &timeline )
55{

Callers 1

selectMethod · 0.80

Calls 8

randFloatFunction · 0.85
EaseInAtanClass · 0.85
EaseNoneClass · 0.85
EaseOutAtanClass · 0.85
randIntFunction · 0.85
appendToMethod · 0.80
bindFunction · 0.50
applyMethod · 0.45

Tested by

no test coverage detected