本文整理汇总了TypeScript中@angular/core.keyframes函数的典型用法代码示例。如果您正苦于以下问题:TypeScript keyframes函数的具体用法?TypeScript keyframes怎么用?TypeScript keyframes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了keyframes函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should get annotations for HeroDetailComponent', () => {
const HeroDetailComponent =
reflector.findDeclaration('src/app/hero-detail.component', 'HeroDetailComponent');
const annotations = reflector.annotations(HeroDetailComponent);
expect(annotations.length).toEqual(1);
const annotation = annotations[0];
expect(annotation.selector).toEqual('my-hero-detail');
expect(annotation.animations).toEqual([trigger('myAnimation', [
state('state1', style({'background': 'white'})),
transition(
'* => *',
sequence([group([animate(
'1s 0.5s',
keyframes([style({'background': 'blue'}), style({'background': 'red'})]))])]))
])]);
});
示例2: Collapse
export function Collapse(duration: number = 300) {
return trigger('collapse', [
state('collapsed, true, void', style({
height: '0',
opacity: '0',
overflow: 'hidden'
})),
state('expanded, false', style({
height: '*',
opacity: '1',
overflow: 'hidden'
})),
transition('true => false, collapsed => expanded', [
animate(duration+'ms ease', keyframes([
style({opacity: '1'}),
style({height: '*'})
]))
]),
transition('false => true, expanded => collapsed', [
animate(duration+'ms ease', style({height: '0'}))
])
])
}
示例3: trigger
import { trigger, state, style, transition, animate,keyframes } from '@angular/core';
export const flyIn = trigger('flyIn', [
state('in', style({transform: 'translateX(0)'})),
transition('void => *', [
animate(500, keyframes([
style({opacity: 0, transform: 'translateX(100%)', offset: 0}),
style({opacity: 1, transform: 'translateX(25px)', offset: 0.3}),
style({opacity: 1, transform: 'translateX(0)', offset: 1.0})
]))
]),
transition('* => void', [
animate(500, keyframes([
style({opacity: 1, transform: 'translateX(0)', offset: 0}),
style({opacity: 1, transform: 'translateX(-25px)', offset: 0.7}),
style({opacity: 0, transform: 'translateX(-100%)', offset: 1.0})
]))
])
]);
示例4: trigger
import { trigger, state, style, transition, animate,keyframes } from '@angular/core';
export const fadeIn = trigger('fadeIn', [
state('in', style({transform: 'translateX(0)'})),
transition('void => *', [
animate(800, keyframes([
style({opacity: 0}),
style({opacity: 0.2}),
style({opacity: 0.4}),
style({opacity: 0.6}),
style({opacity: 0.8}),
style({opacity: 1})
]))
]),
transition('* => void', [
animate(800, keyframes([
style({opacity: 1}),
style({opacity: 0.8}),
style({opacity: 0.6}),
style({opacity: 0.4}),
style({opacity: 0.2}),
style({opacity: 0})
]))
])
]);
示例5: state
state('true', style({opacity: 1})),
state('false', style({opacity: 0})),
transition('0 <=> 1', animate('.5s'))
]),
trigger('postEnter', [
state('void', style({transform: 'translateY(0%)'})),
state('true', style({transform: 'translateY(-20%)'})),
transition('void => true', animate('.5s'))
]),
trigger('fadeOut', [
state('in', style({transform: 'translateY(0px)', opacity: 1})),
state('out', style({transform: 'translateY(-100px)', opacity: 0})),
transition('out => in', animate('.45s')),
transition('in => out', [
animate('275ms 175ms', keyframes([
style({opacity: 1}),
style({opacity: 0})
]))
])
]),
trigger('appearTopBottom', [
state('in', style({transform: 'scaleY(1)', opacity: 1})),
state('out', style({transform: 'scaleY(0)', opacity: 0})),
transition('out => in', animate('.45s')),
transition('in => out', animate('.45s')),
]),
trigger('simpleFade', [
state('void', style({opacity: 0})),
state('*', style({opacity: 1})),
transition('void => *', animate('.5s')),
transition('* => void', animate('.5s')),