android - Positioning confetti -
i following tutorial below add confetti.
final konfettiview konfettiview = (konfettiview)findviewbyid(viewkonfetti); konfettiview.build() .addcolors(color.red, color.green) .setspeed(1f, 5f) .setfadeoutenabled(true) .settimetolive(2000l) .addshapes(shape.rect, shape.circle) .setposition(0f, -359f, -359f, 0f) .stream(200, 5000l);
i want confetti appear top right corner instead of top left. values should put in setposition
method? how method work?
i following https://github.com/danielmartinus/konfetti there not information methods , parameters.
here code on editing yields desired output:
fun setposition(x: float, y: float): particlesystem { location.setx(x) location.sety(y) return } /** * set position range emit particles * random position on x-axis between [minx] , [maxx] , y-axis between [miny] , [maxy] * picked each confetti. * @param [maxx] leave null emit [minx] * @param [maxy] leave null emit [miny] */ fun setposition(minx: float, maxx: float? = null, miny: float, maxy: float? = null): particlesystem { location.betweenx(maxx, maxx) location.betweeny(miny, maxy) return }
refer this answer assemble/adjust orientation , co-ordinates accordingly.
also; if want put co-ordinates; there class motionevent
has getx()
, gety()
methods return coordinates relative view, have discovered.
hope helps....
wiki
Comments
Post a Comment