Rubik's Cube Java applet program
Let me present the Rubik's Cube Java applet program implemented by Josef Jelinek. Once this was the best way to animate the Magic Cube on a website. JAVA used to be installed on all computers but HTML5 + CSS3 has taken its place and because it presented some vulnerability issues and internet browsers might be asking for your permission to play them, even if they're installed. To use the software you must have installed Java on your PC. Using this simple but powerful application you can present algorithms in a very fancy way. Even the Ruwix Rubik's Cube solver program is using this applet to play back the solution.
Drag and move the whole cube and layers with your mouse to test the applet. The operation is quite intuitive, scramble the cube then try to solve it.
The progam is free and open source, modify the source code the way you want. To use it on your website is enough to download the .jar java archive file below.
It's very simple to use, just place your .jar file on your webserver then place the following snippet in you html code. This will display the cube you can see on the top of this page.
<applet code="AnimCube.class" archive="AnimCube.jar" width=200 height=200> <param name="bgcolor" value="EBEBEB"> <param name="colorscheme" value="yworgb"> </applet>
Now you have seen how to initialize and set the parameters of the applet. But there are much more parameters at your disposal:
- bgcolor- Background color hex code. For example 99eebb, FFFFFF
- butbgcolor- Button background color hex code. For example 99eebb, FFFFFF
- colorscheme- Sets the color scheme of the cube. I recommend to set it "yworgb" but this is up to you.
- colors- Set nine custom colors in RGB format.
- position- Set the view angle of the cube. You can use the 'u', 'd', 'f', 'b', 'l' and 'r' characters. Try for example "llllluu".
- speed- Specifies the playback speed. Bigger value (20) results slower animation. 5 is pretty fast.
- doublespeed- Set the speed of the double turns.
- perspective- Set the perspective of the cube (0..5).
- scale- Customize the size of the cube. 0 fills out the applet space while 10 will result a small cube.
- align- Align the cube to the top(0), center(1) or to the bottom(2) of the applet area.
- hint- Setting this value to 10 you will be able to see the colors behind the cube.
- buttonbar- set this variable to 1 to show buttonbar, 0 to hide it.
- edit- Disable the possibility to twist the layers with the mouse (0 or 1)
- movetext- How to display the algorithm on the applet (0..4)
- fonttype- Remove the border from the playback text (0 or 1)
- metric- There are four types of metrics to display an algorithm (0..3)
- move- Set the moves to the cube using the classic notation: U,R,L,B,F,D
- initmove- Specify the starting position for the cube setting a scramble
- initrevmove- The same as the previous but the moves are performed reverse
- demo- Demonstrate different cube moves.
- facelets- Specify one-by-one the colors of the 54 facelets.
Use the following color codes: 0- light orange, 1- pure red, 2- pure green, 3- pure blue, 4- white-grey, 5- yellow-grey, 6- orange-grey, 7- red-grey, 8- green-grey, 9- blue-grey, w- white, y- yellow, o- orange, r- red, g- green, b- blue, l- light grey, d- dark grey, m- magenta, c- cyan, p- pink, n- light green, k- black, everything else is grey.
That's all, have fun!