Seiji Villafranca
github.com/SeijiV13
seijivillafranca.com
github.com/SeijiV13
Senior Developer, Wypoon Technologies Netherlands
Microsoft MVP
Auth0 Ambassador
Community Lead, AngularPH,
Author
seijivillafranca.com
for better UX, can act as a response to user
calls attention of users
interactive and make applications more responsive
CSS animations
@keyframes
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
@keyframes example {
from {background-color: red;}
to {background-color: yellow;}
}CSS animations
Yes CSS animations can be used but avoid them!
CSS animation chaining can be complex
CSS + SVG animation has a strange behavior
support for movements along a path not fully developed
written in JavaScript
uses the concept of states
state('open', style({
height: '200px',
opacity: 1,
backgroundColor: 'yellow'
})),
state('closed', style({
height: '100px',
opacity: 0.8,
backgroundColor: 'blue'
})),Needed to use Angular Animations
@angular/animations
@angular/platform-browser
....
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule
],
....
})
export class AppModule { } animations: [
trigger('openClose', [
// ...
state('open', style({
height: '200px',
opacity: 1,
backgroundColor: 'yellow'
})),
state('closed', style({
height: '100px',
opacity: 0.8,
backgroundColor: 'blue'
})),
transition('open => closed', [
animate('1s')
]),
transition('closed => open', [
animate('0.5s')
]),
]),Introducing Motion One
Motion One
Motion One
smallest fully-featured animation library for the web.
HTML or SVG elements using the Web Animations API
It can animate anything by passing it a custom function, like innerText or Three.js.
"Hardware acceleration" means running animations outside the main JavaScript thread, usually on the GPU
Hardware Acceleration
Motion One
sample code
animate(
this.box?.nativeElement,
{height: '100px', background: 'blue', opacity: 0.8},
{ duration: 1, easing: spring()}
)github.com/SeijiV13
seijivillafranca.com
fb.com/seiji.villafranca
Thank you
and happy coding!