@opherv
YGLF 2019
"Have you tried clearing your cache"?
"No Mom, I don't know why your computer is running slow"
"Don't just add Z-index 999999 that won't work"
Creative Developer
time
frame
Microinteractions for to-do list app/ Jakub Antalík
https://dribbble.com/shots/3167358-Microinteractions-for-to-do-list-app
App data
User input
Meaningful Motion with Action-Driven Animation / Tobias Ahlin
http://tobiasahlin.com/blog/meaningful-motion-w-action-driven-animation/
Meaningful Motion with Action-Driven Animation / Tobias Ahlin
http://tobiasahlin.com/blog/meaningful-motion-w-action-driven-animation/
Meaningful Motion with Action-Driven Animation / Tobias Ahlin
http://tobiasahlin.com/blog/meaningful-motion-w-action-driven-animation/
Inspired by Jing Cheng's talk
https://youtu.be/nYkdrAPrdcw
Inspired by Jing Cheng's talk
https://youtu.be/nYkdrAPrdcw
Inspired by Jing Cheng's talk
https://youtu.be/nYkdrAPrdcw
Inspired by Jing Cheng's talk
https://youtu.be/nYkdrAPrdcw
lessFancySelect:{
selectedOptions: [],
possibleOptions: ['Principle',
'Sketch',
'Framer',
'Photoshop'
]
}
Example data structure:
view renders
view renders
https://dribbble.com/shots/4371972-Graphics-Editor-Selection-Drop-Down
option disappear animation
Squash animation + Rectangle appear animation
Label expand animation
option disappear animation starts
????
// state
lessFancySelect:{
selectedOptions: ['Sketch']
}
// state
lessFancySelect:{
selectedOptions: ['Sketch,
'Photoshop']
}
// state
lessFancySelect:{
selectedOptions: []
}
Skipping
Animation 1
Animation 2
(with fast-forward)
Pro: Animation is always updated relative to the state
Skipping
Con: Jumping between states/animation looks janky
Queuing
Animation 1
Animation 2
Pro: Animations will always flow fluidly
Queuing
Con: UI might not reflect the current state;
Animations play "catch-up" to the state
Additive animation
Animation 1
Animation 2
http://ronnqvi.st/multiple-animations
Skipping
http://ronnqvi.st/multiple-animations
Additive
Pro: Seamlessly joins two animations in a natural way
Additive Animation
Con: Easy for single-element position-animation;
however most animation systems don't fit into this paradigm
Limiting access to UI
Animation 1
Animation 2
Limiting access to UI
Abusing your users
Pro: Makes your designer and PM happy
Limiting access to UI
Con: Makes your users cry
https://github.com/EkoLabs/react-animation-orchestrator
Happy to announce!
1. Create animation sequences
2. Register these sequences to a component
3. Defining scenarios that decide when to trigger the animations
Working with react-animation-orchestrator:
PageComponent
FancyComponent
When PageComponent props change ->
animate FancyComponent
then animate SomeOtherComponent
The Goal:
SomeOtherComponent
// step 1: defining an animation generator function
import { TimelineMax } from 'gsap';
const lookAtMeAnimation = (ref, options) => {
let tl = new TimelineMax();
let myEl = ref.current;
tl.to(myEl, 0.5, {
scale: 1.5,
rotating: '45deg',
transformOrigin: 'center',
opacity: 0.7,
});
return tl;
};
// step 2: registering the animation with a component
import React from "react";
import { attachAnimation } from "@ekolabs/react-animation-orchestrator";
class FancyComponent extends React.Component {
constructor(props){
super(props);
this.ref = React.createRef();
this.props.registerAnimation('lookAtMe', lookAtMeAnimation, this.ref);
}
render(){
return <div ref={this.ref}>Attention-grabbing element</div>
}
}
export default attachAnimation(FancyComponent);
// step 2: registering the animation with a component
import React from "react";
import { attachAnimation } from "@ekolabs/react-animation-orchestrator";
class FancyComponent extends React.Component {
constructor(props){
super(props);
this.ref = React.createRef();
this.props.registerAnimation('lookAtMe', lookAtMeAnimation, this.ref);
}
render(){
return <div ref={this.ref}>Attention-grabbing element</div>
}
}
export default attachAnimation(FancyComponent);
// step 2: registering the animation with a component
import React from "react";
import { attachAnimation } from "@ekolabs/react-animation-orchestrator";
class FancyComponent extends React.Component {
constructor(props){
super(props);
this.ref = React.createRef();
this.props.registerAnimation('lookAtMe', lookAtMeAnimation, this.ref);
}
render(){
return <div ref={this.ref}>Attention-grabbing element</div>
}
}
export default attachAnimation(FancyComponent);
// step 3: Configuring a scenario for a "controller"
// element to queue the animation
import { attachAnimation } from "@ekolabs/react-animation-orchestrator";
class PageComponent extends React.Component {
render(){
return (
<div>
<FancyComponent/>
<SomeOtherComponent />
<MoreComponents />
</div>
)
}
}
export default attachAnimation(PageComponent, [
{
trigger: {
select: props => props.grabAttention,
value: false,
nextValue: true
},
animations: ['lookAtMe', 'animationOnSomeOtherComponent']
}
]);
The problem:
F(time) = frame
F(old state, action) = new state
Possible solutions:
Cut and skip animation
Queue animation
Additive animtion
@OpherV
slides.com/opherv/yglf2019
The Pac-Man rule
by @ericholscher
Addendum
@OpherV
slides.com/opherv/yglf2019