If set, the user can rotate the board around on its axis, unless OrbitControls.js has not been loaded.ĭetermines whether files and ranks are labeled (files a through h, ranks 1 through 8) Values are piece abbreviations such as 'wK' for white knight or 'bP' for black pawn. Keys are squares ( 'a1' through 'a8', 'h1' through 'h8', etc.) The object would typically look like this: The initial position of the board specified in chessboard.js format. The initial position of the board as a FEN string.Īccepts 'start' as an alias for the starting FEN 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR' Squares are 2x2, so the bounding box for a piece mesh should be restricted to for x and y the board itself lies on the z=0 plane. It then slaps white and black PhongMaterials on NOTE: At present chessboard3.js only loads mesh geometries from the JSON files, without any added textures. If pieceSet is a function, the only argument is a one character piece code. In chessboard.js the analogous setting is pieceTheme for specifying the location of 12 image files- 'wK.png', 'bQ.png', etc.)Ī configuration object can have both of these set chessboard.js will ignore one and chessboard3.js will ignore the other. The JSON files required are K.json, Q.json, R.json, B.json, N.json, and P.json, and each specifies the geometry of one type of piece, regardless of color, in three.js format. This setting is specific to chessboard3.js. (This is actually implemented by changing the camera position.)Ī template string for the URL of the piece mesh files, where '' gets replaced by 'K', 'Q', 'R', 'B', or 'P'. This specifies the initial orientation of the board. This needs to be set to false to see any results if piece mesh files are being edited. This setting is specific to chessboard3.js.ĭetermines whether piece meshes should be cached using the localStorage API. Using 'trash' generally makes no sense unless 'sparePieces' is set to true. Otherwise, 'snapback' makes those pieces snap back to their original square. If set to 'trash', the user can drag pieces off the board to get rid of them. If set to true, the user can drag pieces to other squares or off the board.ĭefault value of false makes a "read-only" board that restricts control of the board position to code. The config object can have the following properties and methods: Var board = new ChessBoard3('some_div_id', config)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |