epatel / EPGLTransitionView

OpenGL ES view for animating a view transition.
http://www.memention.com/blog/2010/02/28/Bells-and-Whistles.html
393 stars 68 forks source link

Speed up DemoTransition One #12

Closed MattFoley closed 11 years ago

MattFoley commented 11 years ago

Is it possible to speed up DemoTransition one, or set a length of time? With a 100kb image, it usually takes a second or two to finish the transition on device, even on an iPhone 5. I'd like it to be closer to .5s.

epatel commented 11 years ago

If it's the falling block demo I tested this little tweak, from line 128 in DemoTransition.m

    if (moved<4) {
        int num = 2;
        if (rand()%100 > 50) {
            while (1) { // naïve loop to find a none moving square
                i = rand()%4;
                if (!(dyOut[i][j] > 0.0)) {
                    dyOut[i][j] = 0.02;
                    if (!--num)
                        break; // got one, leave now
                }
            }
        }
        break; // no more moving squares, leave outer loop
    }

this is initiate falling of two blocks and not only one at a time, which makes it run faster.

Hope that helps.

MattFoley commented 11 years ago

Ah, wow, that's incredibly awesome! Thank you!