Android: Custom View for simulating water wave effects, android Water Wave

Source: Internet
Author: User

Android: Custom View for simulating water wave effects, android Water Wave

Github address: https://github.com/nuptboyzhb/WaterWaveView

Welcome Fork, welcome Star

1. Check the effect first.


2. Check the key code again.

Plotting Function y = Asin (wx + d) + offset

/*** Use the Path to depict the drawn area ** @ 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 point in 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

QQ group of Android Development Alliance:272209595

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.