i searched on internet no success. need animate imageview along path. have created path using:
path path = new path() path.moveto(0, 0); path.lineto(184,776); path.lineto(184,780); path.lineto(184,790); path.lineto(184,810); path.lineto(230, 900); imageview img = new imageview(this);
is there way can move img along path? thank all
here animators use:
purpose: move view "view" along path "path"
v21+:
valueanimator pathanimator = objectanimator.offloat(view, "x", "y", path)
v11+:
valueanimator pathanimator = valueanimator.offloat(0.0f, 1.0f); pathanimator.addupdatelistener(new valueanimator.animatorupdatelistener() { float[] point = new float[2]; @override public void onanimationupdate(valueanimator animation) { float val = animation.getanimatedfraction(); pathmeasure pathmeasure = new pathmeasure(path, true); pathmeasure.getpostan(pathmeasure.getlength() * val, point, null); view.setx(point[0]); view.sety(point[1]); } });
same as: android, move bitmap along path?
Comments
Post a Comment