當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript animations.state函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。