search
HomeWeChat AppletMini Program DevelopmentImplementation of animation animation in WeChat applet

Implementation of animation animation in WeChat applet

May 19, 2018 pm 05:09 PM
animationaccomplishApplets

This article mainly introduces in detail the method of realizing animation animation in WeChat applet. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

1. Create animation instance

wx.createAnimation(OBJECT)

Create an animation Instance animation. Call the instance's methods to describe the animation. Finally, the animation data is exported through the export method of the animation instance and passed to the animation property of the component.
Note: The export method will clear the previous animation operation after each call

Animation queue

Calling animation operation Step() must be called after the method to indicate the completion of a group of animations. You can call any number of animation methods in a group of animations. All animations in a group of animations will start at the same time. The next group of animations will not proceed until one group of animations is completed. . step can pass in a configuration parameter similar to wx.createAnimation() to specify the configuration of the current group animation. Animation execution can be called by binding animations to events.

The created animation instance can be described by calling the animation method. After the call is completed, it will return to itself, supporting chain call writing.
Within the same animation instance, you can define multiple motion forms and define multiple animations bound to different tags

Sample code:

animation1: {}
animation2: {}

touch: function () {
 let animation1 = wx.createAnimation({
  transformOrigin: "50% 50%",
  duration: 1000,
  timingFunction: "ease",
  delay: 0
 });
 animation1.translateX(-app.globalData.windowWidth * 0.7).step({ duration: 1000 });
 this.setData({
  animation1: animation1.export()
 });
 let animation2 = wx.createAnimation({
  transformOrigin: "50% 50%",
  duration: 1000,
  timingFunction: "ease",
  delay: 0
 });
 animation2.opacity(0.7).step({ duration: 1000 });
 this.setData({
  animation2: animation2.export()
 });
}

2. Call animation execution

2.1 Bind animation

Bind the created animation instance to Corresponding tag

Sample code

<view animation="{{animation1}}"></view>
<view animation="{{animation2}}"></view>

2.2 Trigger animation

Calling animation execution through page events

Sample code:

<view bindtap="touch"></view>

Related recommendations:

Tutorial on using CSS animation animation

Use CSS3 animation animation properties to implement carousel images Detailed explanation of the effect method

Introduction to the skillful use of css3 animation animation special effects plug-in

The above is the detailed content of Implementation of animation animation in WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool