【发布时间】:2019-11-15 11:52:19
【问题描述】:
我需要从右向左滑动三张图片,下一张图片应该过渡。
我拥有STACKBLITZ中所需的所有代码
HTML:
<ngb-carousel *ngIf="images" [showNavigationArrows]="showNavigationArrows" [showNavigationIndicators]="showNavigationIndicators">
<ng-template ngbSlide *ngFor="let image of images">
<div class="picsum-img-wrapper">
<img [src]="image" alt="Random slide">
</div>
<div class="carousel-caption">
<button>Touch to start</button>
</div>
</ng-template>
</ngb-carousel>
动画图像所需的角度动画:
animations: [
trigger('slide', [
state('previousLeft', style({
display: 'none',
transform: 'translateX(-100%)'
})),
state('previousRight', style({
display: 'none',
transform: 'translateX(100%)'
})),
transition('hidden => activeLeft, previousRight => activeLeft', [
style({
display: 'block',
transform: 'translateX(100%)'
}),
animate('0.6s')
]),
transition('hidden => activeRight, previousLeft => activeRight', [
style({
display: 'block',
transform: 'translateX(-100%)'
}),
animate('0.6s')
]),
transition('activeLeft => previousLeft, activeRight => previousRight,' +
'activeRight => previousLeft, activeLeft => previousRight,' +
'active => previousLeft, active => previousRight', [
style({
display: 'block'
}),
animate('0.6s')
])
])
],
我希望它表现得像这样: Another Stackblitz
为了实现该功能,任何帮助都会很棒。
【问题讨论】:
-
你可以在哪里工作?
-
@kontenurban 还没有,这周我会再试一次看看。
-
期待!
标签: html css angular typescript