Create Particles that will follow you"re finger

13,474 posts
Thanks Meter: 10,948
By SpaceCaker, Recognized Themer / Contributor on 19th August 2014, 12:23 PM
Post Reply Subscribe to Thread Email Thread
As the title suggests.

I have seen this in xperia z2 lockscreen and wanted to recreate that effect
I googled arround but only found some which also needed me to create a game of it which i dont want

I want to have a view and can simply move my finger in it and let sparkles,particles,smoke etc drag under it

Anyone knows how?

Sent from my C5303 using XDA Free mobile app
19th August 2014, 03:11 PM |#2  
mohamedrashad's Avatar
Senior Member
Flag ismailia
Thanks Meter: 604
Create a view (sparkles or whatever) and at ontouch listener update the parameters of X & Y
I made this in a previous app of mine (Floata) but you can adapt it to the app

here you are :

Adding the view :

	twitterp = new WindowManager.LayoutParams(

		twitterp.gravity = Gravity.TOP | Gravity.LEFT;
		twitterp.x = 0;
		twitterp.y = 0;

		windowManager.addView(twitter, twitterp);

twitter.setOnTouchListener(new View.OnTouchListener() {

			private int initialX;
			private int initialY;
			private float initialTouchX;
			private float initialTouchY;

			public boolean onTouch(View v, MotionEvent event) {


				switch (event.getAction()) {

				case MotionEvent.ACTION_DOWN:
					initialX = twitterp.x;
					initialY = twitterp.y;
					initialTouchX = event.getRawX();
					initialTouchY = event.getRawY();

					return false;

				case MotionEvent.ACTION_UP:

					return false;
				case MotionEvent.ACTION_MOVE:
					twitterp.x = initialX
							+ (int) (event.getRawX() - initialTouchX);
					twitterp.y = initialY
							+ (int) (event.getRawY() - initialTouchY);

					windowManager.updateViewLayout(twitter, twitterp);


					return false;

				return false;

this is a floating object (like a chathead of Fb messenger) , you can use the samew concept in your app i think
The Following User Says Thank You to mohamedrashad For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes