Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Frad LEE FradSer

🎯
Focusing
View GitHub Profile
@FradSer
FradSer / SketchSystems.spec
Last active Jul 9, 2020
Nippon Colors Game
View SketchSystems.spec
Nippon Colors Game
is color hited -> Color Display
Color Mixer
Color Display
is color changed -> Color Mixer
View SwiftUI Challenge - C01B01.swift
@State var timeCount: Double = 0.0
var timer: Timer {
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) {timer in
self.timeCount += 0.1
}
}
View SwiftUI Challenge - C01B03.swift
Text(timeString(time: timeCount))
.onAppear(perform: {
let _ = self.timer
})
View SwiftUI Challenge - C01B02.swift
func timeString(time: Double) -> String {
return String(format: "%.1f", time)
}
View TrackableScrollView.swift
//
// TrackableScrollView.swift
// ToutiaoARDemo
//
// Created by Frad LEE on 2020/6/21.
// Copyright © 2020 Frad LEE. All rights reserved.
//
import SwiftUI
View gifify.sh
# Usage: gifify foobar [--good]
gifify () {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 1200x1200\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -vf scale=1200:-1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
@FradSer
FradSer / gifify.zsh
Last active Jul 26, 2021
Video to gif with ffmpeg.
View gifify.zsh
function gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 1200x1200\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -vf scale=1200:-1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else