-1

As title, I'm currently working on an Android project. I need to implement a feature similar to "tap to like" on Instagram.

I think this feature could be described in this way. When tapping the button, a small image(heart icon on Instagram) floats from the position of the button in a random path, with fade-out effect, and finally disappear.

Any simple way to do this?

enter image description here

Dayo Choul
  • 861
  • 2
  • 9
  • 23

2 Answers2

1

You can use library like https://github.com/plattysoft/Leonids

Get the particle drawable that you want. Set it up

new ParticleSystem(this, MAX_PARTICLES_COUNT, R.drawable.heart, LIFESPAN_MILLIS)
.setSpeedModuleAndAngleRange(speedMin, speedMax, minAngle, maxAngle)
.setFadeOut(milisecondsBeforeEnd, interpolator interpolator)
.oneShot(anchorView, numParticles);

Play with the settings until result that you want.

loshkin
  • 1,600
  • 2
  • 21
  • 38
0

Finally, I use Bezier Curves to draw the path and make the heart pic move along w/ it

Dayo Choul
  • 861
  • 2
  • 9
  • 23