The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

haha1111 (5) [Avatar] Offline
#1
If you find yourself looking for the VCR control on some of the animations (like pause and frame advance), here's a mini VCR function. Useful on fast animation sequence like Listing 5.7 spiral sphere:

// Instruction: append to end of program
// Press right_arrow to advance frame
// Hit any other key to toggle play and pause
int _go = 1;
void keyPressed(){
if (_go == 1){
noLoop();
_go = 0;
}
else if (key == CODED) {
if (keyCode == RIGHT) {
redraw();
}
}
else {
loop();
_go = 1;
}
}

Enjoy.