JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
| import { useLayoutEffect, useCallback, useState } from 'react' | |
| export const useRect = (ref) => { | |
| const [rect, setRect] = useState(getRect(ref ? ref.current : null)) | |
| const handleResize = useCallback(() => { | |
| if (!ref.current) { | |
| return | |
| } |
| import * as React from "react" | |
| function useAnimationTimer(duration = 1000, delay = 0) { | |
| const [elapsed, setTime] = React.useState(0) | |
| React.useEffect(() => { | |
| let animationFrame, timerStop, start | |
| // Function to be executed on each animation frame | |
| function onFrame() { |
| "use strict"; | |
| // animation utils | |
| // =============== | |
| const trackTime = timing => { | |
| const now = performance.now(); | |
| if (!timing.startTime) timing.startTime = now; | |
| const elapsed = now - timing.startTime; |
JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;