我想在Angular4项目中使用animejs.
我一直在寻找一些提示和线索如何继续这个,但几乎没有任何地方.
我一直在寻找一些提示和线索如何继续这个,但几乎没有任何地方.
所以我试图沿x坐标移动框…
import { Component,OnInit } from '@angular/core'; import anime from 'animejs'; @Component({ selector: 'app-animejs-logo',templateUrl: './animejs-logo.component.html',styleUrls: ['./animejs-logo.component.scss'] }) export class AnimejslogoComponent { animation = anime({ targets: ['.Box'],translateX: [ { value: 500,duration: 1000 },{ value: 0,duration: 1000 } ],duration: 2000,loop: true }); animate() { console.log('play'); this.animation.play(); } }
animejs-logo.component.scss:
.Box { position: relative; width: 50px; height: 50px; margin: 4px; } .red { background-color: #f00; } .green { background-color: #0f0; } .blue { background-color: #00f; }
animejs-logo.component.html:
<div class="container"> <button (click)="animate()">Play</button> <div class="Box red"></div> <div class="Box green"></div> <div class="Box blue"></div> </div>
如你所见,没有什么特别或令人难以置信的.首先试试animejs ……
可以请有人解释我的错误吗?为什么不点火?
我在控制台,项目的编译中没有任何错误.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。