GitHub Address: Https://github.com/nuptboyzhb/WaterWaveView
Welcome to the fork, welcome to star
1. First look at the effect
2. See the key code again
Description function y = Asin (wx+d) +offset
/** * Use the path to paint the area drawn * * @return */private path Getfristwavepath () {//Draw the path of area 1 if (Firstwavepath = = null) {Firstwavepath = new Path ();} Firstwavepath.reset (); Firstwavepath.moveto (0, height);//move to the lower left corner for (float x = 0; x <= width; x + = X_step) {Float y = (float) (Waveheight * Math.sin (Omega * x + movewave) + waveheight) + heightoffset;firstwavepath.lineto (x, y);} Firstwavepath.lineto (width, 0); Firstwavepath.lineto (width, height); return firstwavepath;}
More communication
Android Development Alliance QQ Group: 272209595
Android: Custom view for simulating water-wave effects