Custom Button Functionality

This example uses a modified version of AnimCube3.js to display the cube similar to Twizzle. The cube is shown at the end of the move sequence when the page loads and the Play button is modified to reset the cube prior to animating. For proper operation the repeat parameter is disabled, functionality is same as with repeat=0 with addition of Play mod.



Code Mods:

1. In the init function, disable repeat.

repeatable = false;

2. Also fast-forward to end of sequence when the page loads.

startAnimation(buttonAction[6]);

3. In the button function, add code so the play button resets before playing the sequence.

else if (buttonPressed == 4) {
  if (movePos == move[curMove].length) 
    clear();
  startAnimation(buttonAction[buttonPressed]);
}

4. Also modify the next/prev sequence button so it fast-forwards to end of sequence.

setTimeout(startAnimation, 0, buttonAction[6]);


Close