1 实现一个简单的动画
html页面
<div class="content">
<button (click)="showaside()">弹出侧边栏</button>
<button (click)="hiddenaside()">隐藏侧边栏</button>
</div>
<aside id="aside">
侧边栏
</aside>
ts页面
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-aniamations',
templateUrl: './aniamations.component.html',
styleUrls: ['./aniamations.component.less']
})
export class AniamationsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
showaside(){
let asideDom:any = document.getElementById('aside')
asideDom.style.transform = 'translateX(0)'
}
hiddenaside(){
let asideDom:any = document.getElementById('aside')
asideDom.style.transform = 'translateX(100%)'
}
}