Animation principle of sweeping robot

Source: Internet
Author: User

Use jquery to create a sweeping robot animation. The animation effect is that the left side of the screen is some rubbish, then the picture is a sweeping robot, sweeping robot from the right to the left, and then swept the rubbish will be sucked into the sweep of the robot and disappeared.

Theory: By judging the relationship between the coordinates of the garbage element and the sweep robot's coordinates, it is judged whether the rubbish has been swept by the sweeping robot, and then the rubbish swept away will be hidden.

The principle of implementation: Use the Animate () function of jquery to make a small move, and then use the callback callback function of animate (), each time you move to determine whether the garbage has been swept by the sweep robot, the garbage swept away will be hidden. The function is then put into a timer to execute, using the SetInterval function, you can adjust the time to make the animation smooth. If the sweep robot finishes sweeping, turn off the timer.

Note: If you need to repeat execution from scratch after the animation has been performed, be aware that the last timer that was cleaned up will open normally the second time it is run.

Animation principle of sweeping robot

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.