本文整理匯總了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')),