See the Pen animation example 1 - CSS | keyframe animation by Johan Bijlsma (@johanbijlsma) on CodePen.
See the Pen animation example 1 - JS | simple animation by Johan Bijlsma (@johanbijlsma) on CodePen.
See the Pen Animation example 2 - JS | RequestAnimationFrame by Johan Bijlsma (@johanbijlsma) on CodePen.
See the Pen Animation example 2 - CSS | simple transition by Johan Bijlsma (@johanbijlsma) on CodePen.
See the Pen Animation example 2 - JS | simple transition by Johan Bijlsma (@johanbijlsma) on CodePen.
de Syntax is vrij simpel:
/* property name | duration | timing function | delay */
transition: margin-right 4s ease-in-out 1s;
Maar je kunt ook verschillende properties stylen:
/* property name | duration | timing function | delay */
transition: margin-right 4s ease-in-out 1s,
background-color 2s linear 50ms;
Hiermee kun je met 1 CSS declaration meerdere transitions mee geven.
Daarnaast bestaan ook de attributes all en none.
de animation syntax is iets complexer:
/* @keyframes duration | timing-function | delay |
iteration-count | direction | fill-mode | play-state | name */
animation: 3s ease-in 1s 2 reverse both paused slidein;
Bovenstaande code wordt toegegevoegd aan het element dat je wil animeren. Maar eerst moet de animatie nog worden gedefinieerd
Een @keyframes animatie
@keyframes bgFade {
0% {
background-color: rgba(255, 255, 255, 0.2);
}
100% {
background-color: rgba(197, 29, 29, 0.45);
}
}Een @keyframes animatie moet een minimaal een naam hebben. Percentages zijn niet verplicht (from en to zijn ook toegestaan).
De syntax is iets complexer dan CSS :
const animation = element.animate(keyframes, options);
Greensock is een JavaScript Animation Framework
Greensock biedt een hoop extra mogelijkheden.
gsap.togsap.fromgsap.timelimeGSAP demo
GSAP demo
Bring your components to life with simple spring animation primitives...
Bring your components to life with simple spring animation primitives...