This article mainly introduces in detail the demo of small program learning: simple picture animation red envelope code, which has a certain reference value. interested friends can refer to it.
Var app = getApp (); Page ({data: {userInfo: {}, src: '', coverImg: {hidden: false, top: 0, // the top value of the image above is bottom: 0, // The bottom value of the image below is locked: false // The homepage is displayed and locked}, openPage: app. globalData. openPage = 1? True: false}, resetCoverImg: function () {this. setData ({coverImg: {hidden: false, top: '0', bottom: '0'})}, bindOpenTap: function () {var that = this; if (! That. data. coverImg. locked) {that. setData ({coverImg: {locked: true}); var dis = 0; var timer = setInterval (function () {dis-= 1; that. setData ({coverImg: {top: dis + '%', bottom: dis + '%'})}, 10); setTimeout (function () {clearInterval (timer ); // expand the home page that. setData ({coverImg: {hidden: true, locked: false}) // if (that. data. openPage) {that. goToOpenPage ();} else {that. goToListPage (); }}, 500) ;}, goToListPage: function () {wx. navigateTo ({url :'.. /list/list'})}, goToOpenPage: function () {wx. navigateTo ({url :'.. /open/open'})}, // share onqueue appmessage: function () {app. updateUserInfo ({'type': 0}); return {title: 'preferer Pro', desc: 'preferer Pro', path: 'pages/index/index' }}, onShow: function () {this. resetCoverImg ();}})
The above is the demo for learning small programs: detailed content of the simple picture animation red envelope code. For more information, see other related articles in the first PHP community!