The PocketPlayer applet can be use to display an interactive model of Rubik's Pocket Cube™ on a web page.
Interactive 3D model
The applet renders realistically looking 3D models of a PocketCube. You can rotate and twist the cube using the mouse pointer.
Animation
The applet can play back a sequence of moves. You can control playback using a Quicktime-like user interface.
Customizability
Many aspects of the applet can be controlled by parameters and/or by specifying an external XML resource file. You can change the colors of the cube and apply a picture to the background and its stickers. You can even define your own notation for scripts.
PocketPlayer is free of a charge for non-commercial use.
If you have a feature request or if you want to honour my work on this applet, send a bottle of good wine to me.
PocketPlayer needs a browser supporting Java 1.3.
You can embed the applet into your HTML document using the applet tag shown below.
You can customize the applet using these parameters or by specyfing an XML resource file. You can even do both, for example, you could specify the notation and the color scheme of the cube using an XML resource file, and then override some of the values using parameters in the applet tag.
The following listings shows the supported parameters and their default values:
<applet
code="PocketPlayer.class"
archive="PocketPlayer.jar"
width="264" height="245">
or
<applet
code="PocketPlayerFlat.class"
archive="PocketPlayerFlat.jar"
width="264" height="245">
<param name="resourceFile" value="">
<param name="notation" value="">
<param name="scriptType" value="Generator">
<param name="script" value="">
<param name="scriptProgress" value="-1">
<param name="initScript" value="">
<param name="displayLines" value="">
<param name="autoPlay" value="true">
<param name="showPlayer" value="true">
<param name="showInfo" value="false">
<param name="cube" value="">
<param name="visibleCornerParts" value="urf,dfr,ubr,drb,ulb,dbl,ufl,dlf">
<param name="visibleEdgeParts" value="ur,rf,dr,bu,rb,bd,ul,lb,dl,fu,lf,fd">
<param name="visibleSideParts" value="r,u,f,l,d,b">
<param name="colorMap" value="r=#ff4600,u=#ffd200,f=#003373,l=#8c000f,d=#f8f8f8,b=#00732f">
<param name="faceList" value="0,1,2,3,4,5">
<param name="stickerList" value="0,0,0,0, 1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4, 5,5,5,5">
<param name="stickerListFront" value="0,0,0,0">
<param name="stickerListRight" value="1,1,1,1">
<param name="stickerListDown" value="2,2,2,2">
<param name="stickerListBack" value="3,3,3,3">
<param name="stickerListLeft" value="4,4,4,4">
<param name="stickerListUp" value="5,5,5,5">
<param name="stickersImage" value="">
<param name="backgroundColor" value="#ffffff">
<param name="backgroundImage" value="">
<param name="alpha" value="-25">
<param name="beta" value="45">
<param name="ambientLightIntensity" value="1.0">
<param name="lightSourceIntensity" value="0.6">
<param name="lightSourcePosition" value="-500,500,1000">
<param name="twistDuration" value="400">
<param name="debug" value="false">
</applet>
The following parameters are supported for backwards compatibility. These parameters are based on the faces listed in the order f-r-d-b-l-u.
<param name="colorTable" value="#003373,#ff4600,#f8f8f8,#00732f,#8c000f,#ffd200">
<param name="faces" value="0,1,2,3,red,5">
<param name="stickers" value="0,0,0,0, 1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4, 5,5,5,5">
<param name="stickersFront" value="0,0,0,0">
<param name="stickersRight" value="1,1,1,1">
<param name="stickersDown" value="2,2,2,2">
<param name="stickersBack" value="3,3,3,3">
<param name="stickersLeft" value="4,4,4,4">
<param name="stickersUp" value="5,5,5,5">
<param name="stickersImage" value="SignedCube.jpg">
Using a resource file, you can specify the following things:
You can reference your resource file using the parameter resourceFile.
The applet picks up the default notation, and the default cube specified in the resource file.
You can explicitly refer a specific notation, cube and script from the XML file using the parameters notation and cube.
You will be able create the XML resource file using CubeTwister 2, once it is finished. For now, you can use the XML Notation Tool, to define your own notation.
The file PocketCubeNotations.xml is part of the PocketPlayer distribution. This file contains a number of example notations.
The directory PocketPlayerApplet contains the bundled applet files.
PocketPlayer.jar, .jar.gz, .jar.pack.gz
Renders the cube using a realistically looking phong shader. Can apply a picture to the stickers of the cube and to the background of the applet. This applet needs lots of memory to run. Don't put more than a handful on a single web page.
PocketPlayerFlat.jar, .jar.gz, .jar.pack.gz
Renders the cube using a resource friendly flat shader. Can only appy a picture to the background of the applet.
This applet is resource friendly. You can put up to 50 on a single web page.
To make the applet work, you should at least upload the following files onto your webserver. You can put these files into the same directory which contains your HTML documents, or into a separate directory:
PocketPlayer.jar
PocketPlayerFlat.jar
PocketCubeNotations.xml
If your web-server supports PHP scripts, you can significantly improve the download-time of the applet, by uploading the following files to your web-server:
PocketPlayer.jar
PocketPlayer.jar.gz
PocketPlayer.jar.pack.gz
PocketPlayerFlat.jar
PocketPlayerFlat.jar.gz
PocketPlayerFlat.jar.pack.gz
PocketCubeNotations.xml
pack200.php
The get the improved performance, reference the applet using the following archive tag: archive="pack200.php/PocketPlayer.jar".
Alternatively, you can configure the web-server to automatically invoke the pack200.php script, when a .jar file is requested.
To get automatic invocation of the pack200.php script with an Apache web-server, you need to upload a .htaccess file into the directory. Here is how the .htaccess file should look like, when you put all files into a web-directory named /pocketplayer:
The PocketPlayer applet has been programmed by Werner Randelshofer.
PocketPlayer © 2007
Werner Randelshofer
All Rights Reserved.
idx3d Engine © 1999/2000
Peter Walser
All Rights Reserved.
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland
werner.randelshofer@bluewin.ch
www.randelshofer.ch
Trademarks:
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. or other countries, and are used under license.
PocketPlayer is not derived from, is not associated with and is not endorsed or sponsered by the owner of the RUBIK'S POCKET CUBE Trademark. This owner is Seven Towns Limited, the manufacturer and worldwide distributor of the RUBIK'S POCKET CUBE three dimensional puzzle and provider of an electronic version of the puzzle via its official web site.