Wednesday, May 30, 2012

Shake it like a Polaroid picture!

I am happy to report that Photo Cube 2.4 was released last week, and the new Album mode is proving as popular as I suspected.

This week I have been playing around with the Android  sensors, seeing how I can apply 3d movements of phone and tablets to Photo Cube.

The first idea is detecting shakes.


At the simplest level, it can already detect that you are shaking the phone (say 2 or 3 back and forth movements in any direction), and if you are in Album mode it can then trigger the pictures on the cube to refresh. That is pretty cool! But as there is a slight visual glitch when it updates, I am trying to work out the best way to distract from that, such as giving the cube an extra spin, or perhaps rapidly shrinking it, changing the images then restoring to the usual size. I will go with whichever looks best. I tried a simple "Refreshing from album" message but it looked ugly, I am not having that. :o)

Next, detecting a left or right movement on the phone can be used to give the cube a bit of extra spin in that appropriate direction. Still playing with that so it doesn't clash with shaking, and making it jive with the extra spin you already get when you pan your home screen left and right.

Other motion ideas would be to detect left, right, up or down movement and then perhaps bounce the cube in that direction, so you could shake the phone up, and the cube would rapidly move up, bounce off the top of the screen then return to its usual place. Same idea for backward and forward, but instead have it grow and shrink. I think the bounch off the "sides" of the screen would be accompanied by a reversal in rotation direction as well, to give more of a 3d realistic feel, kind of the same way a football changes its rotation when bounced off a wall.

The final idea is to make the background appear "behind" the phone using a 3d parallax effect; this would be done by detecting a small rotation angle of up/down, left/right, and shifting the background image a little bit down/up, right/left in response. The maths for that is pretty complex, I need to learn all about 3d rotation matrices so this will be a little harder to implement.

Of course, all these motion detection features will depend on the phone actually supporting them, so will only be enabled when the appropriate sensors exist on the phone. And as usual I will make them all optional, as using those sensors do take a little bit more battery life. However, they would only be used when the Photo Cube wallpaper is actually visible, i.e. no other app is running, and to be honest then the biggest battery drain is always the Screen itself rather than the relatively small amount of calculations Photo Cube requires.

I want to get some of these ideas finished before I move back to my other long delayed top secret app, which is still totally unique and has no equal in the market. ;o) 

1 comment: