[Angular2 Animation] Basic animation
@Component({
selector: 'app-courses',
templateUrl: './courses.component.html',
styleUrls: ['./courses.component.css'],
animations: [
trigger('courseHover', [
state('inactive', style({
backgroundColor: '#eee',
transform: 'scale(1)'
})),
state('active', style({
backgroundColor: '#cfd8dc',
transform: 'scale(1.1)'
})),
transition('inactive => active', animate('300ms ease-in')),
transition('active => inactive', animate('300ms ease-out'))
])
]
})
Animation start in 'trigger' function. Give a name call 'courseHover'.
Animation also define 'state', and using 'transition' to animte the state.
<table>
<tr *ngFor="let course of (allCourses | async)" [@courseHover]="course.hover" (mouseenter)="course.hover='active'"
(mouseleave)="course.hover='inactive'">
<td class="column course-icon">
<img [src]="course?.iconUrl">
</td>
<td class="column course-description">
{{course.description}}
</td>
<td>
<button [routerLink]="course.url">View</button>
</td>
</tr>
</table>
So when mouse enter and mouse leave we set 'course.hover' to 'active' or 'inactive'.
[@courseHover]="course.hover"
Apply 'courseHover' animation acoording to the 'course.hover'.
[Angular2 Animation] Basic animation的更多相关文章
- Animation & Property Animation 使用
本篇主要讲Animation 和 Property Animation的使用,最后会讲QQ管家桌面火箭作为例子: 在Android中开发动效有两套框架可以使用,分别为 Animation 和 Prop ...
- Android动画总结#补间动画(Tween Animation/View Animation) #帧动画(Frame Animation/Drawable Animation)#属性动画(PropertyAnimation)
1.共有三种动画,英文名字多种叫法如下 第一种动画:补间动画(Tween Animation/View Animation) 四个:RotateAnimation旋转. AlphaAnimation透 ...
- angular2 学习笔记 ( animation 动画 )
refer : https://angular.io/guide/animations https://github.com/angular/angular/blob/master/packages/ ...
- Unity Animation.CrossFade Animation.Play
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerCo ...
- [Angular] Two ways to create Angular Animation, using animation() or using state()
We have two blocks to show to difference ways to do animation in Angular: <button (click)="t ...
- CSS animation & CSS animation 101
CSS animation 101 如何为 Web 添加动画效果. https://github.com/cssanimation/css-animation-101 https://github.c ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- iOS Programming Controlling Animations 动画
iOS Programming Controlling Animations 动画 The word "animation" is derived from a Latin wor ...
- Facebook POP 进阶指南
本文转自Kevin Blog Facebook 在发布了 Paper 之后,似乎还不满足于只是将其作为一个概念性产品,更进一步开源了其背后的动画引擎 POP,此举大有三年前发布的 iOS UI 框架 ...
随机推荐
- POJ 2181 贪心
思路: 贪心 对于每个波浪 ans+=最大值-最小值 注意最后一定是选最大值 //By SiriusRen #include <cstdio> using namespace std; i ...
- mybatis在XML中大于号转义字符
mybatis在编写sql时不能在XML里直接使用‘<’ 或者是 ‘>’ 在这里需要使用转义字符替换 下面列举常用的xml转义对应: * < < ...
- C/C++(基础-常量,类型转换)
字符 char ascII码表 #include<stdio.h> int main() { unsigned char ch; for(ch = 0;ch < 128;ch++) ...
- col---过滤控制字符
- PHP截取字符串长度
<?php function str_cut($string, $start=0,$length, $dot = '..') { $strlen = strlen($string); ...
- 【Codeforces Round #427 (Div. 2) D】Palindromic characteristics
[Link]:http://codeforces.com/contest/835/problem/D [Description] 给你一个字符串; 让你在其中找到1..k阶的回文子串; 并统计它们的数 ...
- ORA-01653 无法在表空间扩展的解决办法 -- 增加表空间大小或给表空间增加数据文件
转自原文 ORA-01653 无法在表空间扩展的解决办法 -- 增加表空间大小或给表空间增加数据文件 当前系统的数据量越来越大的,昨天还运行正常的数据库,突然无法使用了.经过定位发现是"OR ...
- linux 命令之 tar
作用 tar命令是Unix/Linux系统中备份文件的可靠方法.差点儿能够工作于不论什么环境中,它的使用权限是全部用户. 语法: tar [主选项+辅选项] 文件或文件夹 主选项: c 创建新的归档文 ...
- Oracle442个应用场景-----------Oracle数据库物理结构
-------------------------Oracle数据库物理结构------------------------------- Oracle数据库物理结构 oracle的数据,实际 ...
- 源代码编译安装CloudStack 4.2
基于CentOS 6.4安装CloudStack 环境配置 # yum -y update # yum -y upgrade 安装NTP,jdk 1.7, tomcat 6, mysql,git等服务 ...