First look at the effect
This is the effect under iOS, completely consistent under Android. With the Do_gestureview component and the Do_animation component, Deviceone can easily achieve a complex cross-platform pure native animation effect, this example is the gesture control picture up and down animation sliding to achieve the opening and closing effect, but also support the sound effect.
Here's the main code
Index.ui.js
varDo_animator1 = mm ("Do_animator");d O_animator1.append (500, {y:-1334, Curve:"Linear"});varDo_animator2 = mm ("Do_animator");d O_animator2.append (500, {y:0, Curve:"Linear"});d O_page.on ("Nextpagemoveing",function() {CurrentView=Json_define[currentindex].view; Currentindex++; if(currentindex>=json_define.length) currentindex=0; NextView=Json_define[currentindex].view; for(vari=0;i<json_define.length;++i) { if(Json_define[i].view! = CurrentView && Json_define[i].view! =NextView) {json_define[i].view.visible=false; } Else{json_define[i].view.visible=true; }} currentview.fire ("Closingbottom", "Nextpagemove");}); Do_page.on ("Nextpagemove",function() {Nextview.fire ("Initmoving", "nextpagemoved"); });d O_page.on ("Nextpagemoved",function() {currentview.y= 0; Nextview.y= 1332; DO_ALAYOUT_MAIN.Y=0; Do_alayout_main.redraw (); Do_alayout_main.animate (Do_animator1,function() {Nextview.fire ("Opening"); });}); Do_page.on ("Prepagemoveing",function() {CurrentView=Json_define[currentindex].view; Currentindex--; if(currentindex<0) currentindex=json_define.length-1; NextView=Json_define[currentindex].view; Currentview.fire ("Closinghead", "Prepagemove");}); Do_page.on ("Prepagemove",function() {Nextview.fire ("Initmoving", "prepagemoved"); });d O_page.on ("Prepagemoved",function(){ for(vari=0;i<json_define.length;++i) { if(Json_define[i].view! = CurrentView && Json_define[i].view! =NextView) {json_define[i].view.visible=false; } Else{json_define[i].view.visible=true; }} currentview.y= 1332; Nextview.y= 0; DO_ALAYOUT_MAIN.Y=-1334; Do_alayout_main.redraw (); Do_alayout_main.animate (Do_animator2,function() {Nextview.fire ("Opening"); });});
Full Project Code reference: Https://github.com/do-project/code4do/tree/master/demoECode
Easily implement a gesture animation effect of Android,ios