• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript animations.state函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/animations.state函数的典型用法代码示例。如果您正苦于以下问题:TypeScript state函数的具体用法?TypeScript state怎么用?TypeScript state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了state函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: makeEngine

         () => {
           const engine = makeEngine();
           const trig = trigger('something', [
             state('x', style({opacity: 0})),
             state('y', style({opacity: .5})),
             state('z', style({opacity: 1})),
             transition('* => *', animate(1000)),
           ]);

           registerTrigger(element, engine, trig);
           setProperty(element, engine, trig.name, 'x');
           setProperty(element, engine, trig.name, 'y');
           engine.flush();

           expect(parseFloat(element.style.opacity)).not.toEqual(.5);

           const player1 = engine.players[0];
           setProperty(element, engine, trig.name, 'z');
           engine.flush();

           const player2 = engine.players[0];

           expect(parseFloat(element.style.opacity)).not.toEqual(.5);

           player2.finish();
           expect(parseFloat(element.style.opacity)).toEqual(1);

           player1.finish();
           expect(parseFloat(element.style.opacity)).toEqual(1);
         });
开发者ID:aditya-triconinfotech,项目名称:angular,代码行数:30,代码来源:transition_animation_engine_spec.ts


示例2: it

      it('should cancel all existing players if a removal animation is set to occur', () => {
        const engine = makeEngine();
        const trig = trigger('something', [
          state('m', style({opacity: 0})), state('n', style({opacity: 1})),
          transition('* => *', animate(1000))
        ]);

        registerTrigger(element, engine, trig);
        setProperty(element, engine, trig.name, 'm');
        setProperty(element, engine, trig.name, 'n');
        engine.flush();

        let doneCount = 0;
        function doneCallback() { doneCount++; }

        const player1 = engine.players[0];
        player1.onDone(doneCallback);

        expect(doneCount).toEqual(0);

        setProperty(element, engine, trig.name, 'void');
        engine.flush();

        expect(doneCount).toEqual(1);
      });
开发者ID:aditya-triconinfotech,项目名称:angular,代码行数:25,代码来源:transition_animation_engine_spec.ts


示例3: slideFromUp

export function slideFromUp() {
  return trigger('routerTransition', [
    state('void', style({ 'margin-top': '10px', opacity: '0' })),
    state('*', style({ 'margin-top': '0px', opacity: '1' })),
    transition(':enter', [
      animate('0.3s ease-out', style({ opacity: '1', 'margin-top': '0px' }))
    ])
  ]);
}
开发者ID:fortisant,项目名称:ERP,代码行数:9,代码来源:routerTransition.ts


示例4: slideFromBottom

export function slideFromBottom() {
  return trigger('routerTransition', [
    state('void', style({ 'padding-top': '20px', opacity: '0' })),
    state('*', style({ 'padding-top': '0px', opacity: '1' })),
    transition(':enter', [
      animate('0.33s ease-out', style({ opacity: '1', 'padding-top': '0px' }))
    ])
  ]);
}
开发者ID:fortisant,项目名称:ERP,代码行数:9,代码来源:routerTransition.ts


示例5: it

      it('should construct a trigger based on the states and transition data', () => {
        const result = makeTrigger('name', [
          state('on', style({width: 0})), state('off', style({width: 100})),
          transition('on => off', animate(1000)), transition('off => on', animate(1000))
        ]);

        expect(result.states).toEqual({'on': {width: 0}, 'off': {width: 100}});

        expect(result.transitionFactories.length).toEqual(2);
      });
开发者ID:JohnnyQQQQ,项目名称:angular,代码行数:10,代码来源:animation_trigger_spec.ts


示例6: fadeInAnimation

function fadeInAnimation() {
    return trigger('routerTransition', [
        state('void', style({position:'fixed', width:'100%'}) ),
        state('*', style({position:'fixed', width:'100%'}) ),
        transition(':enter', [
            style({opacity: 0}),
            animate('1.5s', style({opacity: 1}))
        ]),
    ]);
}
开发者ID:meepobrother,项目名称:core,代码行数:10,代码来源:slide-in.animation.ts


示例7: visibility

export function visibility() {
    return trigger('visibility', [
        state('shown', style({
            transform: 'scale(1.0)',
            opacity: 1
        })),
        state('hidden', style({
            transform: 'scale(0.5)',
            opacity: 0
        })),
        transition('* => *', animate('0.5s ease-in-out'))
    ]);
}
开发者ID:sandy100,项目名称:Coursera,代码行数:13,代码来源:app.animation.ts


示例8: flip

export function flip(name = 'flip', first = true, duration = 350, easing = 'ease-in-out') {
  const timings = `${duration}ms ${easing}`;
  return trigger(name, [
    state(first ? 'first' : 'second', style({ transform: `rotateY(${first ? 360 : 0}deg)`, display: 'block' })),
    state(first ? 'second' : 'first', style({ transform: `rotateY(180deg)`, display: 'none' })),
    transition(':enter', animate(0)),
    transition('* => *', animate(`${duration}ms ${easing}`)),
    transition(
      first ? 'second => first' : 'first => second',
      animate(timings, keyframes([style({ display: 'none', offset: 0 }), style({ display: 'block', offset: 0.2 })])),
    ),
  ]);
}
开发者ID:ifiske,项目名称:iFiske,代码行数:13,代码来源:flip.ts



注:本文中的@angular/animations.state函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript animations.style函数代码示例发布时间:2022-05-28
下一篇:
TypeScript animations.stagger函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap