种一颗树,最好的时机是十年期,而后是现在。
The best time to plant a tree was twenty years ago. The second-best time is now.
在微信小程序中,提供了这样一个API——wx.createAnimation(Object object)。该API创建一个动画实例 animation。调用实例的方法来描述动画。
本文主要介绍animation实例的缩放相关的方法及其使用。
假设我们创建了这样一个实例:
this.animationData = wx.createAnimation({
duration: 1000
})
1. Animation.scale(number sx, number sy) X 轴、Y 轴同时缩放sx倍数,>1为放大,<1缩小。
参数:
number sx
当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数
number sy
在 Y 轴缩放 sy 倍数
核心代码:
this.animationData.scale