
Show HN: Rubik's cube variants in different shapes and sizes using canvas 2D API - aditya_r_m
demo
<a href="https:&#x2F;&#x2F;aditya-r-m.github.io&#x2F;twisty-polyhedra&#x2F;" rel="nofollow">https:&#x2F;&#x2F;aditya-r-m.github.io&#x2F;twisty-polyhedra&#x2F;</a><p>article
<a href="https:&#x2F;&#x2F;medium.com&#x2F;@adityam.rtm&#x2F;creating-3d-twisty-puzzles-using-programming-5800fb7eaab8" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@adityam.rtm&#x2F;creating-3d-twisty-puzzles-u...</a><p>source
<a href="https:&#x2F;&#x2F;github.com&#x2F;aditya-r-m&#x2F;twisty-polyhedra" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aditya-r-m&#x2F;twisty-polyhedra</a>
======
app4soft
Sadly, it not work for me.

After click on "play" button nothing happen, look on screenshot[0]

Browser: Pale Moon 28.1.0[1]

[0] [http://i.imgur.com/0GYEa9D.png](http://i.imgur.com/0GYEa9D.png)

[1]
[http://linux.palemoon.org/download/mainline/](http://linux.palemoon.org/download/mainline/)

~~~
aditya_r_m
I passed the code through Google closure compiler.

Now it should work on your browser, assuming that it supports HTML5 canvas
API.

------
RandomGuyDTB
Pretty cool but it'd be nice to have buttons to turn the cube rather than
gestures - or at least an option in the settings for it. Love it either way.

~~~
aditya_r_m
Will add this feature in the TODO list :) thanks!

------
glandium
How do you rotate around the vertical axis on the diamond variants?

~~~
aditya_r_m
I think you may be mistaking them for a different type of puzzle with diamond
shape & similar look. As far as I know,there are two possible variants of
similar looking Octahedron shaped puzzles: 1) Face turning octahedron (the
ones I've currently defined in the project) 2) Axis turning octahedron (on
which you can twist around axis)

------
newuser6969
Cool demo! One thing you could do to improve this is use quaternions to handle
rotation of the cube. There are some great articles on implementing
quaternions out there if you search for them. For example, I noticed when you
turn a cube "upside down", the dragging to the left or right (with ctrl
pressed) rotates the cube the wrong way. Quaternions are a great way to solve
this issue

~~~
aditya_r_m
Improved it, thank you!

Note that Quaternions didn't fix the issue by themselves. I had to change the
interpretation of cursor movements to use axis-angle rotation based
orientation.

The fix could be deployed with or without Quaternions.

