html 旋转,移动,缩放图像动画
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 旋转,移动,缩放图像动画相关的知识,希望对你有一定的参考价值。
import { Component } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';
@Component({
selector: 'photo-gallery',
templateUrl: './photo-gallery.component.html',
styleUrls: ['./photo-gallery.component.css'],
animations: [
trigger("photoState", [
state("move", style({
transform: "translateX(-100%) translateY(50px)"
})),
state("enlarge", style({
transform: "scale(1.5)"
})),
state("spin", style({
transform: "rotateY(180deg) rotateZ(90deg)"
})),
transition("spin=>move", animate("500ms ease-out")),
transition("*=>*", animate("500ms ease")),
])
]
})
export class PhotoGalleryComponent {
position: string;
photoUrl = "http://lorempixel.com/400/200";
changePosition(newPosition: string) {
this.position = newPosition;
}
}
.photo{
margin-bottom: 100px;
margin-left: 100px;
}
<img [src]="photoUrl" [@photoState]="position" class="photo">
<button (click)="changePosition('move')" class="button">Translate</button>
<button (click)="changePosition('spin')" class="button">Rotate</button>
<button (click)="changePosition('enlarge')" class="button">Scale</button>
<button (click)="changePosition(null)" class="button">Reset</button>
以上是关于html 旋转,移动,缩放图像动画的主要内容,如果未能解决你的问题,请参考以下文章
Android 动画
动画1
CSS3炫酷的动画制作技巧—缩放和旋转
HTML5 Canvas 翻译、旋转、缩放
Android动画基础
在图像移动/调整大小/旋转操作中在图像周围放置一些指示符