| Page({data: {
 animationData: {}
 },
 onReady: function () {
 this.animation = wx.createAnimation();
 },
 rotate: function () {
 this.animation.rotate(Math.random() * 720 - 360).step();
 this.setData({animationData: this.animation.export()});
 },
 scale: function () {
 this.animation.scale(Math.random() * 2).step();
 this.setData({animationData: this.animation.export()});
 },
 translate: function () {
 this.animation.translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step();
 this.setData({animationData: this.animation.export()});
 },
 skew: function () {
 this.animation.skew(Math.random() * 90, Math.random() * 90).step();
 this.setData({animationData: this.animation.export()});
 },
 rotateAndScale: function () {
 this.animation.rotate(Math.random() * 720 - 360)
 .scale(Math.random() * 2)
 .step();
 this.setData({animationData: this.animation.export()});
 },
 rotateThenScale: function () {
 this.animation.rotate(Math.random() * 720 - 360).step();
 this.animation.scale(Math.random() * 2).step();
 this.setData({animationData: this.animation.export()});
 },
 all: function () {
 this.animation.rotate(Math.random() * 720 - 360)
 .scale(Math.random() * 2)
 .translate(Math.random() * 100 - 50, Math.random() * 100 - 50)
 .skew(Math.random() * 90, Math.random() * 90)
 .step();
 this.setData({animationData: this.animation.export()});
 },
 allInQueue: function () {
 this.animation.rotate(Math.random() * 720 - 360).step()
 .scale(Math.random() * 2).step()
 .translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
 .skew(Math.random() * 90, Math.random() * 90).step();
 this.setData({animationData: this.animation.export()});
 },
 background: function () {
 this.animation.backgroundColor(`rgb(${Math.random()*255},${Math.random()*255},${Math.random()*255})`).step();
 this.setData({animationData: this.animation.export()});
 },
 opacity: function () {
 this.animation.opacity(Math.random()).step();
 this.setData({animationData: this.animation.export()});
 },
 width: function () {
 this.animation.width(Math.random()*200).step();
 this.setData({animationData: this.animation.export()});
 },
 height: function () {
 this.animation.height(Math.random()*200).step();
 this.setData({animationData: this.animation.export()});
 },
 left: function () {
 this.animation.left(Math.random()*150).step();
 this.setData({animationData: this.animation.export()});
 },
 right: function () {
 this.animation.right(Math.random()*150).step();
 this.setData({animationData: this.animation.export()});
 },
 top: function () {
 this.animation.top(Math.random()*150).step();
 this.setData({animationData: this.animation.export()});
 },
 bottom: function () {
 this.animation.bottom(Math.random()*150).step();
 this.setData({animationData: this.animation.export()});
 },
 })
 
 |