Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Angular练习之animations动画三大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

返回目录

前言

开始练习

回调函数

<div *ngIf="Group" style="height: 100px;width: 100px;BACkground-color: black; border-radius: 50px;"
       [@GroupAnimate]="BoxState" (@GroupAnimate.donE)="CallBACk(false)" (@GroupAnimate.start)="CallBACk(true)">
  </div>


  CallBACk(f:Boolean){
    if(f){
      console.log("动画开始");
    }else {
      console.log("动画结束");
    }
  }

query

/*
query选择器演示
用法和css选择器大致相同
 */
export const QueryAnimate = trigger('QueryAnimate',[
    transition('off=>on',[
      // 先全部隐藏
      query('div',style({ opacity: 0 })),// 再执行动画
      query('.Box-top',animate('500ms',keyframes([
        style({opacity: 0,transform: 'translateY(-400%)',offset: 0}),style({opacity: 1,transform: 'translateY(0)',offset: 1.0})
      ]) )),query('.Box-center',transform: 'translateX(-400%)',transform: 'translateX(0)',query('.Box-foot',transform: 'translateY(400%)',query('h2',keyframes([
        style({transform:'scale(0.5)'}),style({transform: 'scale(1)'})
      ]) )),]),transition('on=>off',[
      query('.Box-top',keyframes([
        style({opacity: 1,transform: 'translateY(0)'}),style({opacity: 0,transform: 'translateY(-400%)'})
      ]) )),transform: 'translateX(0)'}),transform: 'translateX(-400%)'})
      ]) )),transform: 'translateY(400%)'})
      ]) )),keyframes([
        style({transform:'scale(1)'}),style({transform: 'scale(0.5)'})
      ]) )),])
  ]);

源码

源码放在github开源社区上面,随时会更新。所以你下载最新版本的时候会与该文章描述的略有差异。
github地址:https://github.com/yiershan/A...

大佬总结

以上是大佬教程为你收集整理的Angular练习之animations动画三全部内容,希望文章能够帮你解决Angular练习之animations动画三所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。