A simple example of the effect of suction and suction mesh is discussed in the last article, and after further study, there is still a certain gap between the reading and Baidu.
Here's how the latest research works:
It is found that the key point is the sliding, not only the mesh point changes. The trajectory line is also changing, so you need to change the trajectory of the line as you change the points in the Drawbitmapmesh.
Add a function to change the line:
<span style= "FONT-SIZE:24PX;" >public void buildpaths (int timeindex) {float w = mbmpwidth; float h = mbmpheight; Mtimeindex = Timeindex; Mfirstpathmeasure.setpath (Mfirstpath, false); Msecondpathmeasure.setpath (Msecondpath, false); Float[] Pos1 = {0.0f, 0.0f}; Float[] Pos2 = {0.0f, 0.0f}; float Firstlen = Mfirstpathmeasure.getlength (); float Secondlen = Msecondpathmeasure.getlength (); float len1 = firstlen/mhorizontalsplit; float len2 = secondlen/mhorizontalsplit; float firstpointdist = Timeindex * LEN1; float secondpointdist = Timeindex * LEN2; Mfirstpathmeasure.getpostan (firstpointdist, POS1, null); Msecondpathmeasure.getpostan (secondpointdist, pos2, NULL); W = mpathendx; LOG.I ("Yunli", "Timeindex =" + Timeindex + ", W =" + W "), if (Timeindex < 4*MHORIZONTALSPLIT/10) {mthirdpath.reset (); mfort Hpath.reset (); Mthirdpath.moveto (Pos1[0], H/2); Mforthpath.moveto (Pos2[0], H/2); Mthirdpath.cubicto (Pos1[0], pos1[1],w/8+pos1[0],10,3*w/8,10); Mforthpath.cubicto (Pos2[0], pos2[1],w/8+pos2[0],h-10, 3*W/8, h-10); Mthirdpath.quadto ((5*w)/8, N, W, h/2-4); Mforthpath.quadto ((5*w)/8,h-15, W, h/2+4);} else if (Timeindex = = 4*MHORIZONTALSPLIT/10) {mthirdpath.reset (); Mforthpath.reset (); Mthirdpath.moveto (Pos1[0], H/2); Mforthpath.moveto (Pos2[0], H/2); Mthirdpath.cubicto (Pos1[0], pos1[1],5*w/8,15,w,h/2-4); Mforthpath.cubicto (Pos2[0], pos2[1],5*w/8,h-15, W, h/2+4); }else{mthirdpath.reset (); Mforthpath.reset (); Mthirdpath.moveto (Pos1[0], H/2); Mforthpath.moveto (Pos2[0], H/2); Mthirdpath.quadto (Pos1[0], pos1[1], W, h/2-4); Mforthpath.quadto (Pos2[0], pos2[1], W, h/2+4);} }</span>
The idea is to first draw the most primitive trajectory line, with the change of Timeindex, draw different lines, and only when the mesh point,
To place the pathmeasure on the 3rd and 4 temporary lines, the temporary line position is always taken first and second. The above method is described in the previous article,
The main draw is the Bezier curve.
Download Link:
Click to open link
http://download.csdn.net/detail/ahjxly/8554527
Baidu read the perfect version of the slider bar