Commit 77630fec authored by AI Bot's avatar AI Bot

首页3D时间线由Figma导出PNG改为canvas直绘

- 新增 static/timeline-data.js:13年39+5条时间线数据(cn/en),2026年补入真健康医疗、Momenta、奕斯伟计算3条
- addThreeD3.js 按数据直绘切片纹理(逐年块宽/换行宽实测自原稿,虚线年份轴,逐切片绘制规避iOS大画布限制)
- 中文引入 MiSans Light 子集(base.css @font-face),scripts/build-timeline-font.js 并入 npm run build 自动生成(pyftsubset)
- pages/index.js 引入 timeline-data.js
Co-Authored-By: 's avatarClaude Code <noreply@anthropic.com>
parent 63f3037c
......@@ -3,4 +3,5 @@ node_modules/
/npm-debug.log
.DS_Store
out/
.python-version
\ No newline at end of file
.python-versionscripts/.font-cache/
.playwright-mcp/
......@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && next",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && next build",
"build": "node scripts/build-timeline-font.js && set NODE_OPTIONS=--openssl-legacy-provider && next build",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && next start",
"exportwatch": "nodemon -e js,css,json,md,png,jpg,svg --exec \"npm run export\" --ignore .next/ --ignore out/",
"export": "npm run build && next export",
......
......@@ -42,6 +42,16 @@
url('/static/fonts/ttf/IBMPlexSerif-Medium.ttf') format('truetype')
}
/* 时间线 canvas 专用中文字体:MiSans Light 按字符子集化(仅含 timeline-data.js 用到的字)。
跨平台字形统一接近 PingFang;若 timeline-data.js 新增了子集外的字,会静默回退到 PingFang/雅黑,
需重新子集化。数据字符提取命令见 static/addThreeD3.js 注释 */
@font-face {
font-family: 'MiSans Timeline';
font-style: normal;
font-weight: 300;
src: url('/static/fonts/woff2/MiSans-Timeline-Light.woff2') format('woff2');
}
@font-face {
font-family: "PingFang-SC";
font-weight: 100;
......
......@@ -115,6 +115,11 @@ class FrontPage extends React.Component {
defer="defer"
src="/static/three.min.js"
></script>
<script
key="timelineData"
defer="defer"
src="/static/timeline-data.js"
></script>
<script
key="addThreejs"
defer="defer"
......
// 时间线中文字体子集生成:从 static/timeline-data.js 提取所有用到字符,
// 用 pyftsubset 从 MiSans-Light.ttf 裁出 woff2 子集,输出到
// static/fonts/woff2/MiSans-Timeline-Light.woff2(base.css 中 @font-face 引用)。
//
// 用法: npm run timeline-font (或 node scripts/build-timeline-font.js)
// 依赖: python3 + fonttools + brotli (pip install fonttools brotli)
//
// timeline-data.js 新增文案后必须重跑本脚本,否则新字符会回退到系统字体。
// MiSans 由小米以免费商用许可发布: https://hyperos.mi.com/font
const fs = require('fs')
const path = require('path')
const { execFileSync } = require('child_process')
const root = path.join(__dirname, '..')
const dataFile = path.join(root, 'static/timeline-data.js')
const cacheDir = path.join(__dirname, '.font-cache')
const srcTtf = path.join(cacheDir, 'MiSans-Light.ttf')
const outFile = path.join(root, 'static/fonts/woff2/MiSans-Timeline-Light.woff2')
const TTF_URL = 'https://cdn.cnbj1.fds.api.mi-img.com/vipmlmodel/font/MiSans/MiSans.zip'
function extractChars() {
const src = fs.readFileSync(dataFile, 'utf8')
const chars = new Set()
for (const m of src.match(/'((?:[^'\\]|\\.)*)'/g) || []) {
for (const ch of m.slice(1, -1)) chars.add(ch)
}
// 兜底:ASCII 数字/字母/常用标点(年份、日期、证券代码用 IBM Plex Sans,
// 但子集里保留可避免数据改动时意外缺字)
for (const ch of '0123456789.:;,%()-·') chars.add(ch)
return [...chars].sort().join('')
}
function ensureSourceTtf() {
fs.mkdirSync(cacheDir, { recursive: true })
if (fs.existsSync(srcTtf)) return
console.log('下载 MiSans 官方字体包(约 51MB,仅首次)...')
execFileSync('curl', ['-sL', '--max-time', '300', '-o', path.join(cacheDir, 'misans.zip'), TTF_URL], { stdio: 'inherit' })
console.log('解压 MiSans-Light.ttf ...')
// 中文目录名不定,直接全解压后查找
execFileSync('unzip', ['-o', path.join(cacheDir, 'misans.zip'), '*', '-d', cacheDir + '/zip'], { stdio: 'ignore' })
const found = execFileSync('find', [cacheDir + '/zip', '-name', 'MiSans-Light.ttf']).toString().trim().split('\n')[0]
if (!found) throw new Error('压缩包中未找到 MiSans-Light.ttf')
fs.renameSync(found, srcTtf)
fs.rmSync(cacheDir + '/zip', { recursive: true, force: true })
}
function main() {
const text = extractChars()
console.log('时间线数据共', text.length, '个唯一字符')
ensureSourceTtf()
const charFile = path.join(cacheDir, 'chars.txt')
fs.writeFileSync(charFile, text)
execFileSync('pyftsubset', [
srcTtf,
'--text-file=' + charFile,
'--output-file=' + outFile,
'--flavor=woff2',
'--layout-features=*',
'--no-hinting',
'--desubroutinize'
], { stdio: 'inherit' })
const size = (fs.statSync(outFile).size / 1024).toFixed(1)
console.log('已生成', outFile, '(' + size + ' KB)')
}
main()
var camera, scene, renderer, controls, mat, geo, tex
var pcPicWidth = 21060
var mobilePicWidth = 10554
var slice = Math.round(pcPicWidth / 256)
var isMobile = checkMobile()
var cylinderGroup, cylinderMobileGroup
var materialArray, materialMobileArray
var animId
var target
var lan
var resizeTimer
var radius = pcPicWidth / Math.PI / 12
var planeHeight = 1024 / 6
window.addThreeD = function(en) {
target = document.querySelector('#threeD')
lan = en
init(en)
}
window.removeThreeD = function() {
if (!target) {
return
}
target.innerHTML = ''
this.cancelAnimationFrame(animId)
window.removeEventListener('resize', onWindowResize, false)
return [camera, controls, scene, mat, geo, tex, renderer].map(function(val) {
if (val && val.dispose) {
val.dispose()
val = null
return null
}
})
}
function image(en) {
let img = new Image()
img.src = en ? '/static/img/timeline-en.png' : '/static/img/timeline-cn.png'
return img
}
function imageMobile(en) {
let img = new Image()
img.src = en
? '/static/img/timeline-mobile-en.png'
: '/static/img/timeline-mobile-cn.png'
return img
}
function genMaterialArray(isMobile,en, callback) {
const timeline = isMobile ? imageMobile(en) : image(en)
timeline.onload = function() {
const canvas = document.createElement('canvas')
const sprite = isMobile
? { w: mobilePicWidth / slice, h: 1024 }
: { w: pcPicWidth / slice, h: 1024 }
const context = canvas.getContext('2d')
canvas.height = sprite.h
canvas.width = sprite.w
const canvasArray = []
for (let i = 0; i < slice; i++) {
context.clearRect(0, 0, sprite.w, sprite.h)
context.drawImage(
timeline,
i * sprite.w,
0,
sprite.w,
sprite.h,
0,
0,
sprite.w,
sprite.h
)
canvasArray.push(canvas.toDataURL())
}
callback(canvasArray)
}
}
function getWindowWidth() {
// isMobile = checkMobile()
const w = checkMobile() ? window.innerWidth * 2 : window.innerWidth
return w // > 1440 ? 1440 : w
}
function getWindowHeight() {
if(isMobile) {
return window.innerHeight * 0.88
} else {
return window.innerHeight * 0.68
}
}
function checkMobile() {
let mobile = window.innerWidth < 780
return mobile
}
function initMobileGeo(en) {
cylinderMobileGroup = new THREE.Group()
cylinderMobileGroup.position.y += 40
for (let sliceIndex = 0; sliceIndex < slice; sliceIndex++) {
const w = radius * Math.sin(Math.PI / slice) * 2
const rotation = ((2 * Math.PI) / slice) * sliceIndex
const _debugMaterial = new THREE.MeshBasicMaterial({
color: 16777215 / (sliceIndex * 10 + 1),
transparent: true,
opacity: 0.0002,
})
const geo2 = new THREE.PlaneGeometry(w / 2, planeHeight)
geo2.translate(0, -56, 0.5 * radius * Math.cos(Math.PI / slice))
geo2.rotateY(rotation)
const mesh2 = new THREE.Mesh(geo2, _debugMaterial)
cylinderMobileGroup.add(mesh2)
}
scene.add(cylinderMobileGroup)
genMaterialArray(true,en, function(canvasArray) {
for (let i = 0; i < slice; i++) {
let tex = new THREE.TextureLoader().load(canvasArray[i])
tex.anisotropy = renderer.capabilities.getMaxAnisotropy()
let mat = new THREE.MeshBasicMaterial({
map: tex,
alphaTest: 0.01,
transparent: true,
side: THREE.DoubleSide,
})
cylinderMobileGroup.children[i].material.needsUpdate = true
cylinderMobileGroup.children[i].material = mat
}
})
}
function initPcGeo(en) {
cylinderGroup = new THREE.Group()
cylinderGroup.position.y -= 15
for (let sliceIndex = 0; sliceIndex < slice; sliceIndex++) {
const w = radius * Math.sin(Math.PI / slice) * 2
const rotation = ((2 * Math.PI) / slice) * sliceIndex
const _debugMaterial = new THREE.MeshBasicMaterial({
color: 16777215 / (sliceIndex * 10 + 1),
transparent: true,
opacity: 0.0002,
})
const geo = new THREE.PlaneGeometry(w, planeHeight)
geo.translate(0, 0, radius * Math.cos(Math.PI / slice))
geo.rotateY(rotation)
const mesh = new THREE.Mesh(geo, _debugMaterial)
cylinderGroup.add(mesh)
}
scene.add(cylinderGroup)
genMaterialArray(false, en, function(canvasArray) {
for (let i = 0; i < slice; i++) {
let tex = new THREE.TextureLoader().load(canvasArray[i])
tex.anisotropy = renderer.capabilities.getMaxAnisotropy()
let mat = new THREE.MeshBasicMaterial({
map: tex,
alphaTest: 0.01,
transparent: true,
side: THREE.DoubleSide,
})
cylinderGroup.children[i].material.needsUpdate = true
cylinderGroup.children[i].material = mat
}
})
}
function init(en) {
if (!target) return
if (typeof THREE === 'undefined') {
console.log('three undefined')
return setTimeout(function() {
init(en)
}, 500)
}
renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize(getWindowWidth(), getWindowHeight())
renderer.setPixelRatio(window.devicePixelRatio)
target.appendChild(renderer.domElement)
// set the camera with the frustum parameters
camera = new THREE.PerspectiveCamera(30, getWindowWidth() / getWindowHeight(), 1, 1500)
controls = new THREE.OrbitControls(camera, renderer.domElement)
controls.dampingFactor = 0.6
controls.minPolarAngle = Math.PI / 2 - 0.03
controls.maxPolarAngle = controls.minPolarAngle
controls.enableZoom = false
controls.enableKeys = false
controls.rotateSpeed = 0.5
// scene is like a graph of everything that will be rendered
scene = new THREE.Scene()
scene.background = new THREE.Color(0xffffff)
renderer.render(scene, camera)
scene.fog = new THREE.Fog(0xe3e3e3, 200, isMobile ? 640 : 1024)
if(isMobile) {
initMobileGeo(en)
} else {
initPcGeo(en)
}
controls.update()
onWindowResize()
changeMobile(true)
animate()
window.addEventListener('resize', onWindowResize, false)
}
function handleWindowResize() {
clearTimeout(resizeTimer)
resizeTimer = null
window.removeThreeD()
window.addThreeD(lan)
}
function changeMobile(forceUpdate = false) {
var tmpIsMobile = checkMobile()
if(forceUpdate || isMobile != tmpIsMobile) {
isMobile = tmpIsMobile
if(isMobile) {
scene.remove(cylinderGroup)
if(!cylinderMobileGroup) {
initMobileGeo(lan)
}
scene.add(cylinderMobileGroup)
} else {
scene.remove(cylinderMobileGroup)
if(!cylinderGroup) {
initPcGeo(lan)
}
scene.add(cylinderGroup)
}
camera.position.set(0, 0, isMobile ? 700 : 1000)
scene.fog.near = isMobile ? 500 : 500
scene.fog.far = isMobile ? 550 : 1500
controls.update()
}
}
function onWindowResize() {
if (resizeTimer) {
clearTimeout(resizeTimer)
resizeTimer = setTimeout(handleWindowResize, 100)
}
camera.aspect = getWindowWidth() / getWindowHeight()
camera.updateProjectionMatrix()
renderer.setSize(getWindowWidth(), getWindowHeight())
changeMobile()
}
function animate(time) {
animId = requestAnimationFrame(animate)
if(isMobile) {
cylinderMobileGroup.rotation.y = -time * 0.00005;
}else {
cylinderGroup.rotation.y = -time * 0.00005;
}
render()
}
function render() {
renderer.render(scene, camera)
}
var camera, scene, renderer, controls, mat, geo, tex
var pcPicWidth = 21060
var mobilePicWidth = 10554
var slice = Math.round(pcPicWidth / 256)
var isMobile = checkMobile()
var cylinderGroup, cylinderMobileGroup
var materialArray, materialMobileArray
var animId
var target
var lan
var resizeTimer
var radius = pcPicWidth / Math.PI / 12
var planeHeight = 1024 / 6
// —— canvas 直绘时间线的排版参数(对照原 PNG 逐像素量得) ——
// 原版每年块的宽度并不均匀(内容多的块更宽),blockWidths 为逐块实测值;
// 日期列在年份标签左侧约 12px 处;换行宽度按块给定(窄块 ~810,长条目块加宽)
// CN PC: 图 21060x1024;EN PC: 图 21331x1068(原图更高,文字最深到 y1058)
// CN Mobile: 10554x1024;EN Mobile: 10632x1024
var TL_LAYOUT = {
pc: {
picWidth: pcPicWidth,
picHeight: 1024,
firstBlockX: 14,
blockWidths: [1558, 1559, 1558, 1559, 1558, 1558, 1559, 1558, 1559, 1558, 1558, 1559, 2345],
dateShift: -12, // 日期列相对年份标签左移
yearFontH: 158,
yearTop: 36,
yearNarrow: 0.895,
lineY: 282,
lineH: 4,
dashStart: 20266,
dashOn: 14,
dashOff: 19,
fontCjk: 36,
linePitch: 48,
entryExtra: 25,
firstEntryTop: 355,
dateOffset: 148,
// 每块正文换行宽(实测原 PNG 正文墨迹最大宽;CN 全部 1395)
textWraps: [1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1200]
},
mobile: {
picWidth: mobilePicWidth,
picHeight: 1024,
firstBlockX: 10,
blockWidths: [788, 787, 787, 787, 787, 788, 787, 787, 787, 787, 788, 787, 1097],
dateShift: -8,
yearFontH: 115,
yearTop: 26,
yearNarrow: 0.895,
lineY: 206,
lineH: 4,
dashStart: null,
dashOn: 14,
dashOff: 19,
fontCjk: 28,
linePitch: 46,
entryExtra: 16,
firstEntryTop: 267,
dateOffset: 87,
textWraps: [411, 411, 401, 403, 566, 409, 500, 412, 396, 405, 404, 652, 668],
dropYearSuffix: true // 原版移动端窄日期列放不下 "2018年",退化为 "2018"
}
}
// 英文版单独布局(块宽与中文不同,PC 版更高 1068)
TL_LAYOUT.pcEn = Object.assign({}, TL_LAYOUT.pc, {
picWidth: 21331,
picHeight: 1068,
blockWidths: [1515, 1514, 1515, 1515, 1514, 1515, 1952, 1515, 1514, 1515, 1515, 1716, 2355],
dashStart: 20536,
textWraps: [776, 1088, 813, 807, 1209, 809, 1521, 957, 818, 834, 804, 1633, 1384]
})
TL_LAYOUT.mobileEn = Object.assign({}, TL_LAYOUT.mobile, {
picWidth: 10632,
picHeight: 1024,
blockWidths: [744, 744, 744, 743, 1008, 744, 914, 744, 744, 743, 744, 848, 1158],
textWraps: [310, 406, 436, 315, 708, 315, 658, 542, 297, 300, 290, 665, 667]
})
// 中文用自托管的 MiSans Timeline 子集(跨平台统一、接近 PingFang;见 base.css @font-face),
// Latin 与数字由 IBM Plex Sans 覆盖,子集外的字回退到 PingFang/雅黑
var CANVAS_FONT_STACK =
"'IBM Plex Sans', 'MiSans Timeline', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif"
// 对外入口(与旧版 addThreeD.js 一致,由 pages/index.js 调用)
window.addThreeD = function(en) {
target = document.querySelector('#threeD')
lan = en
init(en)
}
window.removeThreeD = function() {
if (!target) {
return
}
target.innerHTML = ''
cancelAnimationFrame(animId)
window.removeEventListener('resize', onWindowResize, false)
return [camera, controls, scene, cylinderGroup, cylinderMobileGroup, renderer].map(function(val) {
if (val && val.dispose) {
val.dispose()
return null
}
return null
})
}
// 按像素宽度断行:英文优先在空格断,CJK 可任意字符断,标点不落行首
function wrapText(ctx, text, maxWidth) {
var lines = []
var paragraphs = text.split('\n')
for (var p = 0; p < paragraphs.length; p++) {
var remaining = paragraphs[p]
while (remaining.length) {
if (ctx.measureText(remaining).width <= maxWidth) {
lines.push(remaining)
break
}
var lo = 1,
hi = remaining.length,
mid,
best = 1
while (lo <= hi) {
mid = Math.floor((lo + hi) / 2)
if (ctx.measureText(remaining.slice(0, mid)).width <= maxWidth) {
best = mid
lo = mid + 1
} else {
hi = mid - 1
}
}
var cut = best
var nextChar = remaining.charAt(best)
if (nextChar && !/[,。;、)]/.test(nextChar)) {
var spaceIdx = remaining.lastIndexOf(' ', best)
if (spaceIdx > best * 0.5) cut = spaceIdx + 1
} else {
cut = best + 1
}
lines.push(remaining.slice(0, cut).replace(/\s+$/, ''))
remaining = remaining.slice(cut).replace(/^\s+/, '')
}
}
return lines
}
// 把时间线绘制到第 i 个切片的 canvas 上(逐切片绘制,避免 iOS 大画布尺寸限制)
function drawTimelineStrip(ctx, layout, data, sliceIndex, spriteW) {
var picH = layout.picHeight
var dark = '#1a1a1a'
ctx.clearRect(0, 0, spriteW, picH)
function localX(x) {
return x - sliceIndex * spriteW
}
// 1. 贯穿分隔横线:实线到 dashStart,之后虚线
ctx.fillStyle = dark
var solidEnd = layout.dashStart == null ? layout.picWidth : layout.dashStart
var x0 = Math.max(sliceIndex * spriteW, 0)
var x1 = Math.min((sliceIndex + 1) * spriteW, solidEnd)
if (x1 > x0) {
ctx.fillRect(localX(x0), layout.lineY, x1 - x0, layout.lineH)
}
if (layout.dashStart != null && (sliceIndex + 1) * spriteW > layout.dashStart) {
var d0 = Math.max(sliceIndex * spriteW, layout.dashStart)
var d1 = Math.min((sliceIndex + 1) * spriteW, layout.picWidth)
for (var dx = d0; dx < d1; dx += layout.dashOn + layout.dashOff) {
var segEnd = Math.min(dx + layout.dashOn, d1)
if (segEnd > dx) {
ctx.fillRect(localX(dx), layout.lineY, segEnd - dx, layout.lineH)
}
}
}
// 2. 每年:年份数字 + 条目列表(块宽与换行宽按块取自原 PNG 实测值)
var yearFontPx = layout.yearFontH / 0.72
var blockX = layout.firstBlockX
for (var y = 0; y < data.length; y++) {
var yearLabel = data[y][0]
var entries = data[y][1]
var blockW = layout.blockWidths[y]
ctx.save()
ctx.font = '400 ' + yearFontPx + 'px ' + CANVAS_FONT_STACK
ctx.fillStyle = dark
ctx.textBaseline = 'alphabetic'
ctx.translate(localX(blockX), layout.yearTop + layout.yearFontH)
ctx.scale(layout.yearNarrow, 1)
ctx.fillText(yearLabel, 0, 0)
ctx.restore()
ctx.font = '300 ' + layout.fontCjk + 'px ' + CANVAS_FONT_STACK
ctx.fillStyle = dark
ctx.textBaseline = 'top'
var cursorY = layout.firstEntryTop
for (var e = 0; e < entries.length; e++) {
var dateStr = entries[e][0]
if (layout.dropYearSuffix && /^\d{4}年$/.test(dateStr)) {
dateStr = dateStr.slice(0, 4)
}
var text = entries[e][1]
if (dateStr) {
ctx.fillText(dateStr, localX(blockX + layout.dateShift), cursorY)
}
var textX = blockX + layout.dateOffset
var wrap = layout.textWraps ? layout.textWraps[y] : layout.textWrap
var lines = wrapText(ctx, text, wrap)
for (var li = 0; li < lines.length; li++) {
ctx.fillText(lines[li], localX(textX), cursorY + li * layout.linePitch)
}
cursorY += lines.length * layout.linePitch + layout.entryExtra
}
blockX += blockW
}
}
// 等待 webfont 加载完成(canvas 绘制不会自动等待)
function ensureFontsLoaded(callback) {
if (!document.fonts || !document.fonts.load) {
return callback()
}
Promise.all([
document.fonts.load("400 200px 'IBM Plex Sans'"),
document.fonts.load("300 36px 'IBM Plex Sans'"),
// 带示例文本,按 unicode-range 只加载子集中实际用到的分片
document.fonts.load(
"300 36px 'MiSans Timeline'",
window.TIMELINE_DATA
? JSON.stringify(window.TIMELINE_DATA.cn)
: '时间线'
)
])
.then(function() { callback() })
.catch(function() { callback() })
}
// 用数据绘制生成切片 canvas 数组(替代 Figma 导出的 PNG)
function genMaterialArray(isMobileFlag, en, callback) {
var layout = isMobileFlag ? (en ? TL_LAYOUT.mobileEn : TL_LAYOUT.mobile)
: (en ? TL_LAYOUT.pcEn : TL_LAYOUT.pc)
var sprite = { w: layout.picWidth / slice, h: layout.picHeight }
var langData =
window.TIMELINE_DATA && (en ? window.TIMELINE_DATA.en : window.TIMELINE_DATA.cn)
if (!langData) {
console.log('timeline data missing')
return
}
ensureFontsLoaded(function() {
var canvas = document.createElement('canvas')
canvas.height = sprite.h
canvas.width = sprite.w
var context = canvas.getContext('2d')
var canvasArray = []
for (var i = 0; i < slice; i++) {
drawTimelineStrip(context, layout, langData, i, sprite.w)
canvasArray.push(canvas.toDataURL())
}
callback(canvasArray)
})
}
function getWindowWidth() {
// isMobile = checkMobile()
const w = checkMobile() ? window.innerWidth * 2 : window.innerWidth
return w // > 1440 ? 1440 : w
}
function getWindowHeight() {
if(isMobile) {
return window.innerHeight * 0.88
} else {
return window.innerHeight * 0.68
}
}
function checkMobile() {
let mobile = window.innerWidth < 780
return mobile
}
function initMobileGeo(en) {
cylinderMobileGroup = new THREE.Group()
cylinderMobileGroup.position.y += 40
for (let sliceIndex = 0; sliceIndex < slice; sliceIndex++) {
const w = radius * Math.sin(Math.PI / slice) * 2
const rotation = ((2 * Math.PI) / slice) * sliceIndex
const _debugMaterial = new THREE.MeshBasicMaterial({
color: 16777215 / (sliceIndex * 10 + 1),
transparent: true,
opacity: 0.0002,
})
const geo2 = new THREE.PlaneGeometry(w / 2, planeHeight)
geo2.translate(0, -56, 0.5 * radius * Math.cos(Math.PI / slice))
geo2.rotateY(rotation)
const mesh2 = new THREE.Mesh(geo2, _debugMaterial)
cylinderMobileGroup.add(mesh2)
}
scene.add(cylinderMobileGroup)
window.__tlMobileGroup = cylinderMobileGroup // debug
genMaterialArray(true,en, function(canvasArray) {
for (let i = 0; i < slice; i++) {
let tex = new THREE.TextureLoader().load(canvasArray[i])
tex.anisotropy = renderer.capabilities.getMaxAnisotropy()
let mat = new THREE.MeshBasicMaterial({
map: tex,
alphaTest: 0.01,
transparent: true,
side: THREE.DoubleSide,
})
cylinderMobileGroup.children[i].material.needsUpdate = true
cylinderMobileGroup.children[i].material = mat
}
})
}
function initPcGeo(en) {
cylinderGroup = new THREE.Group()
cylinderGroup.position.y -= 15
for (let sliceIndex = 0; sliceIndex < slice; sliceIndex++) {
const w = radius * Math.sin(Math.PI / slice) * 2
const rotation = ((2 * Math.PI) / slice) * sliceIndex
const _debugMaterial = new THREE.MeshBasicMaterial({
color: 16777215 / (sliceIndex * 10 + 1),
transparent: true,
opacity: 0.0002,
})
const geo = new THREE.PlaneGeometry(w, planeHeight)
geo.translate(0, 0, radius * Math.cos(Math.PI / slice))
geo.rotateY(rotation)
const mesh = new THREE.Mesh(geo, _debugMaterial)
cylinderGroup.add(mesh)
}
scene.add(cylinderGroup)
window.__tlGroup = cylinderGroup // debug: 便于测试时直接检查切片纹理
genMaterialArray(false, en, function(canvasArray) {
for (let i = 0; i < slice; i++) {
let tex = new THREE.TextureLoader().load(canvasArray[i])
tex.anisotropy = renderer.capabilities.getMaxAnisotropy()
let mat = new THREE.MeshBasicMaterial({
map: tex,
alphaTest: 0.01,
transparent: true,
side: THREE.DoubleSide,
})
cylinderGroup.children[i].material.needsUpdate = true
cylinderGroup.children[i].material = mat
}
})
}
function init(en) {
if (!target) return
if (typeof THREE === 'undefined') {
console.log('three undefined')
return setTimeout(function() {
init(en)
}, 500)
}
renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize(getWindowWidth(), getWindowHeight())
renderer.setPixelRatio(window.devicePixelRatio)
target.appendChild(renderer.domElement)
// set the camera with the frustum parameters
camera = new THREE.PerspectiveCamera(30, getWindowWidth() / getWindowHeight(), 1, 1500)
controls = new THREE.OrbitControls(camera, renderer.domElement)
controls.dampingFactor = 0.6
controls.minPolarAngle = Math.PI / 2 - 0.03
controls.maxPolarAngle = controls.minPolarAngle
controls.enableZoom = false
controls.enableKeys = false
controls.rotateSpeed = 0.5
// scene is like a graph of everything that will be rendered
scene = new THREE.Scene()
scene.background = new THREE.Color(0xffffff)
renderer.render(scene, camera)
scene.fog = new THREE.Fog(0xe3e3e3, 200, isMobile ? 640 : 1024)
if(isMobile) {
initMobileGeo(en)
} else {
initPcGeo(en)
}
controls.update()
onWindowResize()
changeMobile(true)
animate()
window.addEventListener('resize', onWindowResize, false)
}
function handleWindowResize() {
clearTimeout(resizeTimer)
resizeTimer = null
window.removeThreeD()
window.addThreeD(lan)
}
function changeMobile(forceUpdate = false) {
var tmpIsMobile = checkMobile()
if(forceUpdate || isMobile != tmpIsMobile) {
isMobile = tmpIsMobile
if(isMobile) {
scene.remove(cylinderGroup)
if(!cylinderMobileGroup) {
initMobileGeo(lan)
}
scene.add(cylinderMobileGroup)
} else {
scene.remove(cylinderMobileGroup)
if(!cylinderGroup) {
initPcGeo(lan)
}
scene.add(cylinderGroup)
}
camera.position.set(0, 0, isMobile ? 700 : 1000)
scene.fog.near = isMobile ? 500 : 500
scene.fog.far = isMobile ? 550 : 1500
controls.update()
}
}
function onWindowResize() {
if (resizeTimer) {
clearTimeout(resizeTimer)
resizeTimer = setTimeout(handleWindowResize, 100)
}
camera.aspect = getWindowWidth() / getWindowHeight()
camera.updateProjectionMatrix()
renderer.setSize(getWindowWidth(), getWindowHeight())
changeMobile()
}
function animate(time) {
animId = requestAnimationFrame(animate)
if(isMobile) {
cylinderMobileGroup.rotation.y = -time * 0.00005;
}else {
cylinderGroup.rotation.y = -time * 0.00005;
}
render()
}
function render() {
renderer.render(scene, camera)
}
// 时间线数据:直接由 canvas 绘制,替代 Figma 导出的 timeline PNG
// 数据结构: [年份, [[日期, 事件文案], ...]],日期为空字符串时该条目无独立日期列(如 2018年 上市汇总)
window.TIMELINE_DATA = {
cn: [
['2014', [
['01.08', '高榕资本一期美元基金完成募集,金额超过2亿美元,该基金用于投资早期和成长期美元项目。'],
['07.30', '高榕资本一期人民币基金完成募集,金额3.2亿人民币,该基金用于投资早期和成长期人民币项目。']
]],
['2015', [
['01.22', '高榕资本二期美元基金完成募集,金额超过3.6亿美元,该基金用于投资早期和成长期美元项目。'],
['05.01', '高榕资本Co-invest Fund完成募集,金额1亿美元,该基金用于高榕资本一期美元基金所投优质项目的后继投资。'],
['08.08', '高榕资本二期人民币基金完成募集,金额5.6亿人民币,该基金用于投资早期和成长期人民币项目。']
]],
['2016', [
['09.14', '第三方支付公司钱袋宝被美团点评全资收购。'],
['11.16', '智能硬件公司乐心医疗(300562.SZ)在深交所创业板成功上市。']
]],
['2017', [
['03.31', '高榕资本三期美元基金完成募集,金额4亿美元,该基金用于投资早期和成长期美元项目。'],
['03.31', '高榕资本人民币成长基金完成募集,金额25亿人民币,该基金用于投资成长期人民币项目。']
]],
['2018', [
['2018年', '华米(NYSE: HMI)、平安好医生(01833.HK)、虎牙直播(NYSE: HUYA)、拼多多(NASDAQ: PDD)、美团点评(03690.HK)、蘑菇街(NYSE: MOGU)、普惠财富(NASDAQ: PHCF)7家企业成功上市。'],
['05.10', '高榕资本三期人民币基金完成募集,金额5.6亿人民币,该基金用于投资早期和成长期人民币项目。'],
['09.19', '深度学习解决方案公司深鉴科技被赛灵思全资收购。'],
['12.05', '高榕资本四期美元基金完成募集,金额5亿美元,该基金用于投资早期和成长期美元项目。']
]],
['2019', [
['03.05', '移动互联网公司Bigo被YY欢聚时代(NASDAQ: YY)全资收购。'],
['06.06', '在线教育公司跟谁学(NYSE: GSX)在纽交所成功上市。'],
['10.31', '协同管理软件提供商致远互联(688369.SH)在上交所科创板成功上市。']
]],
['2020', [
['02.21', '智能家电研发制造商石头科技(688169.SH)在上交所科创板成功上市。'],
['10.08', '高榕资本五期美元基金完成募集,金额11.5亿美元,该基金用于投资早期和成长期美元项目。'],
['11.19', '中国美妆市场引领者逸仙电商(NYSE: YSG)在纽交所成功上市。'],
['11.24', '联合办公运营商优客工场(NASDAQ: UK)在纳斯达克成功挂牌。'],
['12.07', '高榕资本四期人民币基金完成募集,金额超30亿人民币,该基金用于投资早期和成长期人民币项目。']
]],
['2021', [
['04.06', '全球固态激光雷达领导者Innoviz(NASDAQ: INVZ)在纳斯达克成功上市。'],
['05.07', '中国领先的保险和健康服务科技平台水滴公司(NYSE: WDH)在纽交所成功上市。'],
['06.11', '中国最大的在线招聘平台BOSS直聘(NASDAQ: BZ)在纳斯达克成功上市。'],
['06.29', '中国领先的即时电商叮咚买菜(NYSE: DDL)在纽交所成功上市。'],
['11.08', '中国领先的线上营销服务提供商优矩互动(01948.HK)在港交所成功上市。']
]],
['2022', [
['11.04', '中国领先的专业皮肤护理产品公司巨子生物(02367.HK)在港交所成功上市。'],
['12.26', '中国音视频技术服务商百家云(NASDAQ: RTC)在纳斯达克成功挂牌。']
]],
['2023', [
['10.27', '全球物流服务运营商极兔速递(01519.HK)在港交所主板成功上市。']
]],
['2024', [
['02.02', '精神领域精准药物研发公司Alto Neuroscience(NYSE: ANRO)在纽交所成功上市。']
]],
['2025', [
['01.10', '中国拼搭角色类玩具领导者布鲁可(00325.HK)在港交所主板成功上市。'],
['05.23', '领先分子癌症筛查公司Mirxes觅瑞(02629.HK)在港交所主板成功上市。'],
['06.26', '全球家庭品质护理公司圣贝拉(02508.HK)在港交所主板成功上市。'],
['07.09', '全球智能机器人引领者极智嘉(02590.HK)在港交所主板成功上市。'],
['09.23', '高端育儿产品公司不同集团(06090.HK)在港交所成功上市。'],
['11.27', '线上市场运营商量化派(02685.HK)在港交所成功上市。'],
['12.10', '激光雷达公司Seyond图达通(02665.HK)在港交所成功上市。']
]],
['2026', [
['01.02', '高端通用智能芯片公司壁仞科技(06082.HK)在港交所成功上市。'],
['01.28', '休闲食品饮料连锁零售商鸣鸣很忙(01768.HK)在港交所成功上市。'],
['06.30', '智能手术机器人公司真健康医疗(02697.HK)在港交所成功上市。'],
['07.08', '全球领先的物理AI公司Momenta(06880.HK)在港交所成功上市。'],
['10.09', 'RISC-V芯片设计公司奕斯伟计算(01256.HK)在港交所成功上市。']
]]
],
en: [
['2014', [
['01.08', 'Gaorong Capital successfully completed the fund raising of USD Fund I with a fund size of over USD 200 million, which aims to invest in early and growth-stage startups.'],
['07.30', 'Gaorong Capital successfully completed the fund raising of RMB Fund I with a fund size of CNY 320 million, which aims to invest in early and growth-stage startups.']
]],
['2015', [
['01.22', 'Gaorong Capital successfully completed the fund raising of USD Fund II with a fund size of over USD 360 million, which aims to invest in early and growth-stage startups.'],
['05.01', 'Gaorong Capital successfully completed the fund raising of USD Co-invest Fund with a fund size of USD 100 million, which aims to invest in the follow-on investments of the portfolios invested by Gaorong USD Fund I.'],
['08.08', 'Gaorong Capital successfully completed the fund raising of RMB Fund II with a fund size of CNY 560 million, which aims to invest in early and growth-stage startups.']
]],
['2016', [
['09.14', 'Third-party payment company Qiandaibao was fully acquired by Meituan Dianping.'],
['11.16', 'Smart wearable company Lifesense (300562.SZ) was successfully listed on the SZSE.']
]],
['2017', [
['03.31', 'Gaorong Capital successfully completed the fund raising of USD Fund III with a fund size of USD 400 million, which aims to invest in early and growth-stage startups.'],
['03.31', 'Gaorong Capital successfully completed the fund raising of RMB Growth Fund with a fund size of CNY 2.5 billion, which aims to invest in growth-stage startups.']
]],
['2018', [
['2018', 'Seven Gaorong Capital portfolios successfully went public on the NYSE, NASDAQ, or HKEX, including Huami (NYSE: HMI), Ping An Good Doctor (01833.HK), Huya (NYSE: HUYA), Pinduoduo (NASDAQ: PDD), Meituan Dianping (03690.HK), Mogu (NYSE: MOGU) and Puhui (NASDAQ: PHCF).'],
['05.10', 'Gaorong Capital successfully completed the fund raising of RMB Fund III with a fund size of CNY 560 million, which aims to invest in early and growth-stage startups.'],
['09.19', 'Deep learning solution provider DeePhi was fully acquired by Xilinx.'],
['12.05', 'Gaorong Capital successfully completed the fund raising of USD Fund IV with a fund size of USD 500 million, which aims to invest in early and growth-stage startups.']
]],
['2019', [
['03.05', 'Mobile internet company Bigo was fully acquired by YY (NASDAQ: YY).'],
['06.06', 'Online education institution GSX Techedu (NYSE: GSX) was successfully listed on the NYSE.'],
['10.31', 'Enterprise collaboration software provider Seeyon (688369.SH) was successfully listed on the SSE.']
]],
['2020', [
['02.21', 'Intelligent robot vacuum cleaner company Roborock (688169.SH) was successfully listed on the SSE.'],
['10.08', 'Gaorong Capital successfully completed the fund raising of USD Fund V with a fund size of USD 1.15 billion, which aims to invest in early and growth-stage startups.'],
['11.19', 'A leader in the rapidly evolving China beauty market Yatsen (NYSE: YSG) was successfully listed on the NYSE.'],
['11.24', "China's co-working community operator Ucommune (NASDAQ: UK) was successfully listed on the NASDAQ."],
['12.07', 'Gaorong Capital successfully completed the fund raising of RMB Fund IV with a fund size of over CNY 3 billion, which aims to invest in early and growth-stage startups.']
]],
['2021', [
['04.06', 'A leading manufacturer of solid-state LiDAR sensors and perception software Innoviz (NASDAQ: INVZ) was successfully listed on the NASDAQ.'],
['05.07', 'A leading technology platform dedicated to insurance and healthcare services Waterdrop (NYSE: WDH) was successfully listed on the NYSE.'],
['06.11', "China's online recruitment platform BOSS Zhipin (NASDAQ: BZ) was successfully listed on the NASDAQ."],
['06.29', "China's leading on-demand e-commerce company Dingdong Maicai (NYSE: DDL) was successfully listed on the NYSE."],
['11.08', "China's leading online marketing service provider UJU HOLDING (01948.HK) was successfully listed on the HKEX."]
]],
['2022', [
['11.04', "China's leading professional skin treatment product company Giant Biogene (02367.HK) was successfully listed on the HKEX."],
['12.26', "China's video-centric technology solution provider BaiJiaYun (NASDAQ: RTC) was successfully listed on the NASDAQ."]
]],
['2023', [
['10.27', 'A leading ecommerce logistics company J&T Express (01519.HK) was successfully listed on the HKEX.']
]],
['2024', [
['02.02', 'A clinical-stage biopharmaceutical company that creates precision medicines Alto Neuroscience (NYSE: ANRO) was successfully listed on the NYSE.']
]],
['2025', [
['01.10', "China's leading character-building toy brand Blokees(00325.HK) was successfully listed on the HKEX."],
['05.23', 'A leading provider of molecular cancer screening Mirxes(02629.HK) was successfully listed on the HKEX.'],
['06.26', 'Global premium family care company Saint Bella (02508.HK) was successfully listed on the HKEX.'],
['07.09', 'A global leader in intelligent robotics Geek+(02590.HK) was successfully listed on the HKEX.'],
['09.23', 'High-end parenting products company Butong Group(06090.HK) was successfully listed on the HKEX.'],
['11.27', 'Online marketplace operator Quantgroup(02685.HK) was successfully listed on the HKEX.'],
['12.10', 'A global provider of image-grade LiDAR solutions Seyond(02665.HK) was successfully listed on the HKEX.']
]],
['2026', [
['01.02', 'A high-end general-purpose intelligent chip company Biren Technology(06082.HK) was successfully listed on the HKEX.'],
['01.28', "China's leading chain retailer of casual food and beverages Busy Ming Group(01768.HK) was successfully listed on the HKEX."],
['06.30', 'Surgical robotics company TrueHealth Technology (02697.HK) was successfully listed on the HKEX.'],
['07.08', 'A global leader in physical AI, Momenta (06880.HK), was successfully listed on the HKEX.'],
['10.09', 'RISC-V chip design company ESWIN Computing (01256.HK) was successfully listed on the HKEX.']
]]
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment