Gore Wang , 2020 @ HAPPY CODING
Email:gore.wang.f2e@gmail.com
website: https://gore.wang
Gore Wang
喜歡打造體驗的UXE
喜歡做動畫的F2E
喜歡做動畫的F2E
享受:
Functional:功能性
Natural:自然感
Character:傳達人性的風格
.button {
transition: transform 0.3s ease-out;
&:hover{
transform: scale(1.1) translateY(-5%);
}
}
.man{
animation: ani-jump 0.5s cubic-bezier(0,.69,1,.37);
}
@keyframes ani-jump{
from,to {
transform: 0%;
}
50% {
transform: 50%;
}
}
CSS Transition
CSS Animation
<defs>
<pattern id="p1" patternUnits="userSpaceOnUse" width="20" height="20">
<g>
{isAnimate && (
<animateTransform
id="animate-pattern-g-word"
attributeName="transform"
dur="0.6s"
type="translate"
from="0,0"
to="0,20"
repeatCount="indefinite"
additive="sum"
/>
)}
<rect width="20" height="10" fill="#d2a708" x="0" y="-20"></rect>
<rect width="20" height="10" fill="#d2a708" x="0" y="0"></rect>
</g>
</pattern>
<pattern id="p2" xlinkHref="#p1" patternTransform="rotate(43)" />
<pattern id="p3" xlinkHref="#p1" patternTransform="rotate(40)" />
<pattern id="p4" xlinkHref="#p1" patternTransform="rotate(45)" />
</defs>
偷跑介紹
不具有caback的特性做細部交互
useSpring
<Route
...
children={({ match, ...rest }) => (
<Transition
in={match !== null}
addEndListener={(n, done) => {
if (match !== null) { // route match 到這頁
dispatch(actTransitionStart()); // 限制唯有換頁動態結束後才能再次觸發換頁
animateWillEnter(n, () => {
dispatch(actTransitionEnd());
done(); // 告知 Transition 動態已完成,可以將離開的 Page 正式從 DOM 移除
});
} else {
animateWillLeave(n, done);
}
}}
>
<PageComponent ... />
</Transition>
)}
/>
Transition Group
實現物件 Fade In/Out 間的插拔
Instant response and constant redirection
將熟悉的物理性投影在虛擬世界
Fluid:流體 => 舒服、自然 => 物理預測性
可預期理解的動態
Projection 動量投射
// adapted from Apple's "Designing Fluid Interfaces" talk
// startVelocity = px/ms
const projection = (startVelocity, decelerationRate=0.998) =>
startVelocity * decelerationRate / (1 - decelerationRate)
// example usage
const velocityY = 1.2 // in px/ms
const projectedEndpoint = projection(velocityY) // 679px
const bind = useXXXX(state => {
const {
event, // the source event
xy, // [x,y] values (pointer position or scroll offset)
previous, // previous xy
initial, // xy value when the gesture started
movement, // last gesture offset (xy - initial)
delta, // movement delta (movement - previous movement)
offset, // offset since the first gesture
lastOffset, // offset when the last gesture started
vxvy, // momentum of the gesture per axis
velocity, // absolute velocity of the gesture
distance, // offset distance
direction, // direction per axis
startTime, // gesture start time
elapsedTime, // gesture elapsed time
timeStamp, // timestamp of the event
first, // true when it's the first event
last, // true when it's the last event
active, // true when the gesture is active
memo, // value returned by your handler on its previous run
cancel, // function you can call to interrupt some gestures
canceled, // whether the gesture was canceled (drag and pinch)
down, // true when a mouse button or touch is down
buttons, // number of buttons pressed
touches, // number of fingers touching the screen
args, // arguments you passed to bind
ctrlKey, // true when control key is pressed
altKey, // " " alt " "
shift, // " " shift " "
metaKey, // " " meta " "
dragging, // is the component currently being dragged
moving, // " " " moved
scrolling, // " " " scrolled
wheeling, // " " " wheeled
pinching // " " " pinched
} = state
})
```js
const rubberBand = (distance, dimension, constant = 0.55) =>
(distance * dimension * constant) /
(dimension + constant * distance)
const rubberBandClamp = (min, max, delta, constant) =>
delta < min
? -rubberBand(min - delta, max - min, constant) + min
:delta > max
? rubberBand(delta - max, max - min, constant) + max
: delta
```
tl = gsap
.timeline({
onComplete,
})
.add(animateCardEntry(refs))
.add(animateHatFlyUp(refs))
.add(animateQRCodeZoomAndFind(refs), "-=0.3")
.add(animateQRManLeftHand(refs))
.add(animateQRManRightHand(refs, setIsGWordAnimate))
.add(animateQRCodeOk(refs))
.add(animateCardLeave(refs))
export default function animateQRManRightHand(
{
refHandRight,
refRiseHand,
},
setIsGWordAnimate
) {
const initHandPathCache =
refHandRight.getAttribute("d")
const [codeIcon, codeIconUp] =
refIconCodeGroup.childNodes
return (
gsap
.timeline({
onComplete: setIsGWordAnimate
})
// rise hand
.to(refHandRight, {
morphSVG: refRiseHand,
duration: 0.4,
})
...
document
.getElementById("markpen")
.addEventListener("click", () => {
this.anim.playSegments([[105, 522], [328, 522]], true);
});
即時互動
選項:
Three.js
回過頭來:
打造體驗
桌遊
人類圖
風格性產品