首先我是被这个动画效果吸引到的, 效果好棒
说用到 FLIP (First, Last, Invert, Play) 不要被英文单词吓到, 原理可能比你想象的简单
虽然它很简单, 但也是为了解决一些问题才提出来的.
这个FLIP 要做的事情呢, 就是提高动画的帧率 但是呢, 浏览器这个东西吧, 就是比较矫情, 主要有一下2个特点
- 浏览器 transition 对
opacity
transform
的动画会采用 GPU 加速
'use strict'; | |
function fibonacci(n) { | |
if (n <= 1) { | |
return 1 | |
}; | |
return fibonacci(n - 1) + fibonacci(n - 2); | |
} | |
function fibonacciTail(n, ac1 = 1, ac2 = 1) { |
首先我是被这个动画效果吸引到的, 效果好棒
说用到 FLIP (First, Last, Invert, Play) 不要被英文单词吓到, 原理可能比你想象的简单
虽然它很简单, 但也是为了解决一些问题才提出来的.
这个FLIP 要做的事情呢, 就是提高动画的帧率 但是呢, 浏览器这个东西吧, 就是比较矫情, 主要有一下2个特点
opacity
transform
的动画会采用 GPU 加速import { EventEmitter } from 'events'; | |
import * as SocksProxyAgent from 'socks-proxy-agent'; | |
import * as WebSocket from 'ws'; | |
export class WS extends EventEmitter { | |
private instance?: WebSocket; | |
constructor( | |
private url: string, | |
private proxy?: string |
function formate(num) { | |
return num.toFixed(8).replace(/(.+\.\d\d+?)(0+?)$/, '$1') | |
} | |
formate(0.10000) // 0.10 | |
formate(0.111111000) // 0.111111 |
git checkout . && git clean -xdf |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.12923833727836609</real> | |
<key>Color Space</key> | |
<string>Calibrated</string> |
export function promiseMap<T>(iterable: T[], mapper: (item: T, index?: number) => void, concurrency?: number) { | |
if (!concurrency) { | |
return Promise.all(iterable.map(mapper)); | |
} | |
return new Promise((resolve, reject) => { | |
let ongoing = 0; | |
let completed = 0; | |
const result = Array(iterable.length); | |
const promiseGens = iterable.map((item, index) => { |