question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add animation query() functionality

See original GitHub issue
@Component({
    selector: 'app',
    styleUrls: ['app.css'],
    template: `
<button (click)="exp=!exp">Go</button>
<div class="trigger" [@container]="exp" *ngIf="exp">
  <header #header [@header]="exp ? 'true' : 'false'">header</header>

  <div #body>body</div>

  <footer #footer>footer</footer>
</div>
    `,
    styles: [`
      .trigger {
        display:block;
        padding:1em;
        border:10px solid #888;
      }
      .item {
        width:100px;
        line-height:100px;
        font-size:60px;
        border:10px solid black;
        display:inline-block;
        margin:10px;
        text-align:center;
      }
    `],
    animations: [
        trigger('header', [
          state('true', style({ backgroundColor: 'red' })),
          state('false', style({ backgroundColor: 'blue' })),
          transition('* => *', animate(2000))
        ]),
        trigger('container', [
          state('*', style({ opacity: 1 })),
          state('void', style({ opacity: 0 })),
          transition(':enter', group([
            query('footer', [
              style({ opacity: 0 })
              animate(2000, style({ opacity: 1 }))
            ]),
            query('header', animateChild()),
            query('body', [
              style({ opacity: 0 })
              animate(2000, style({ opacity: 1 }))
            ])
          ])),
          transition(':leave', [
            animate(500)
          ])
        ])
    ]
})
export class App {
  public exp = false;
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:16
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

12reactions
matskocommented, Nov 17, 2016

This will be a new method call to stagger(delay, animation). This way it’s easier to handle preparation styles (which site outside of where stagger() is used).

query('li', [
  style({ opacity: 0 }),
  stagger(200, [ // or -200 to animate things in reverse
    animate(600, style({opacity: 1}))
  ])
])

Once query is in place then having basic staggering support is a super tiny feature to add so it will likely go in within the same release.

7reactions
matskocommented, Mar 29, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

query - Angular
Finds one or more inner elements within the current element that is being animated within a sequence. Use with animate() . query(selector: ...
Read more >
Angular.io v8: animate object and query()-children simple and ...
query finds one or more inner elements within the current element that is being animated within a sequence. Use with animate(); transition and ......
Read more >
jQuery Effects - Animation - W3Schools
The jQuery animate() method is used to create custom animations. Syntax: ... By default, jQuery comes with queue functionality for animations.
Read more >
In-Depth guide into animations in Angular - InDepth.Dev
Angular animation comes with a handy function called animateChild() which as the name suggests, executes the child's animation. You might be ...
Read more >
Practical, real-world animation examples with Angular
The animate() function accepts the timings and styles input parameters. In our example, because our styles are defined in the state() function, we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found