Comments on: How to create parallax effect using accelerometer http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/ Programming, architecture and design (С++, QT, .Net/WPF, Android, iOS, NoSQL, distributed systems, mobile development, image processing, etc...) Thu, 08 Mar 2018 01:52:00 +0000 hourly 1 https://wordpress.org/?v=5.4.2 By: Colin Kiama http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45977 Thu, 08 Mar 2018 01:52:00 +0000 http://vitiy.info/?p=137#comment-45977 Thank you for sharing this. I’ve got something working for Windows 10.

]]>
By: Roberto http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45973 Sun, 27 Aug 2017 04:33:00 +0000 http://vitiy.info/?p=137#comment-45973 Hello, first of all, thank you for sharing this! I’m sorry if this post it’s too old but I’m implementing this and it’s working fine but I need some help. I’m moving a background with this effect but I want it to have a limit, for example, I want that from its original position it only moves a maximum of x -20/+20, y -20/+20

I’m trying to limit this but I only get a mess with every thing I try. Can you help me please?

]]>
By: Виталий Гмызин http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45894 Fri, 10 Apr 2015 07:37:00 +0000 http://vitiy.info/?p=137#comment-45894 http://neartch.ru/

]]>
By: Victor Laskin http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45882 Mon, 02 Mar 2015 11:07:00 +0000 http://vitiy.info/?p=137#comment-45882 In reply to Umran.

I see, you are talking about slightly more ‘strong’ parallax effect. In your case i’m agree – navigating through 3D scene should expect such rotation to be handled properly. But if you take iOS8’s parallaxed wallpaper – you’ll find more ‘simple’ parallax there. ( Nice leafs btw! )

]]>
By: Umran http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45881 Fri, 27 Feb 2015 11:07:00 +0000 http://vitiy.info/?p=137#comment-45881 In reply to Victor Laskin.

I would have to disagree. I think that it’s neither rare nor ideal for people to look left and right in addition to up and down when looking at parallax effects. About gyroscopes, you justify it in your blog that they aren’t available in most of the phones. You say, “…as i found out gyroscope is not present at majority of phones while accelerometer gives enough of data to be happy with it”. I find that’s a good justification not to include it. However, magnetometers/compasses are available in majority of the phones. Isn’t it possible to obtain the bearing from the compass and use that in addition to the pitch and roll you obtain from the accelerometer to include a horizontal component to the parallax effect. Please try out this live wallpaper, it has an option for gravity+compass and compare it to gravity only. (https://play.google.com/store/apps/details?id=com.doctorkettlers.autumn).

]]>
By: Victor Laskin http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45880 Thu, 26 Feb 2015 15:46:00 +0000 http://vitiy.info/?p=137#comment-45880 In reply to Umran.

You are describing rare ideal situation. In practice gravity vector is enough to get the impression. Additional improvement would be to add gyroscopic sensor.

]]>
By: Umran http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45879 Thu, 26 Feb 2015 13:00:00 +0000 http://vitiy.info/?p=137#comment-45879 The accelerometer would only give you the gravity component. This means this wouldn’t work if you rotated the phone left-right (in the horizontal plane) only up-down (either away or towards gravity). You should consider perhaps including sensor input from the magnetometer to sense motion in the horizontal plane.

]]>
By: Victor Laskin http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45803 Wed, 17 Dec 2014 07:13:00 +0000 http://vitiy.info/?p=137#comment-45803 In reply to america.

z is logical depth of item. Its needed when you have several z-layers. If you have only one image background you can use just x=dgX*K, where K – intensity of effect.
Instead of setting width and height, you should probably change some margin, because x,y are offset coordinates – not size. And so you have to shift – not scale.

]]>
By: america http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45802 Tue, 16 Dec 2014 23:11:00 +0000 http://vitiy.info/?p=137#comment-45802 In reply to Victor Laskin.

First, thanks for the response. Reading your answer i understand what means p->x,p->y, so i do this:

view.getLayoutParams().width += dgX * (1. + 10. * “dont know” );
view.getLayoutParams().height -= dgY * (1. + 10. * “dont know”);

But i dont know what value i should put in p->z because my view doesnt have z coordinate, so i put the raw Z value that i get from event.values[2]. I test my app and the image scale in a crazy way, so i think that value is no the correct, what is? and finally in the xml of the imageview, i have to put some specific scaletype? or that doesnt matter.

Thanks for advance.

]]>
By: Victor Laskin http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45801 Tue, 16 Dec 2014 20:59:00 +0000 http://vitiy.info/?p=137#comment-45801 In reply to america.

Hello, p – stands for particle and x,y – it’s coordinates. In your case instead of p should be any objects which you want move (background image, particles, etc)

]]>
By: america http://vitiy.info/how-to-create-parallax-effect-using-accelerometer/#comment-45800 Tue, 16 Dec 2014 20:47:00 +0000 http://vitiy.info/?p=137#comment-45800 Hi, I am in the step 3 and dont understand the last lines. What is the type and value of p. What means this p->x and p->z in the last lines. You have this demo in github? if you has please you could share the link to research more deep. Thanks for the post,

]]>