stupid ahh embed
This commit is contained in:
@@ -79,21 +79,11 @@
|
|||||||
property="og:description"
|
property="og:description"
|
||||||
content="__SEO_DESCRIPTION__"
|
content="__SEO_DESCRIPTION__"
|
||||||
/>
|
/>
|
||||||
<meta property="og:image" content="__PUBLIC_ORIGIN__/embed.svg" />
|
|
||||||
<meta property="og:image:secure_url" content="__PUBLIC_ORIGIN__/embed.svg" />
|
|
||||||
<meta property="og:image:type" content="image/svg+xml" />
|
|
||||||
<meta property="og:image:width" content="1200" />
|
|
||||||
<meta property="og:image:height" content="630" />
|
|
||||||
<meta property="og:image:alt" content="Toothless' TSS Bot share card" />
|
|
||||||
<meta property="og:logo" content="__PUBLIC_ORIGIN__/embed-icon.svg" />
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
<meta name="twitter:title" content="__SEO_TITLE__" />
|
<meta name="twitter:title" content="__SEO_TITLE__" />
|
||||||
<meta
|
<meta
|
||||||
name="twitter:description"
|
name="twitter:description"
|
||||||
content="__SEO_DESCRIPTION__"
|
content="__SEO_DESCRIPTION__"
|
||||||
/>
|
/>
|
||||||
<meta name="twitter:image" content="__PUBLIC_ORIGIN__/embed.svg" />
|
|
||||||
<meta name="twitter:image:alt" content="Toothless' TSS Bot share card" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/embed-icon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/embed-icon.svg" />
|
||||||
<link rel="apple-touch-icon" href="/embed-icon.svg" />
|
<link rel="apple-touch-icon" href="/embed-icon.svg" />
|
||||||
<script type="application/ld+json" id="site-structured-data">
|
<script type="application/ld+json" id="site-structured-data">
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const DRONE_COLOR = '#cbd5e1'
|
|||||||
const DIRECTION_SAMPLE_MS = 700
|
const DIRECTION_SAMPLE_MS = 700
|
||||||
const DIRECTION_BLEND = 0.22
|
const DIRECTION_BLEND = 0.22
|
||||||
const KILL_LINE_WINDOW_MS = 3000
|
const KILL_LINE_WINDOW_MS = 3000
|
||||||
const CAP_INTERP_MAX_GAP_MS = 4000
|
|
||||||
const FLIP_MAP_TEXTURE_Z = true
|
const FLIP_MAP_TEXTURE_Z = true
|
||||||
|
|
||||||
function coordsAreValid(c) {
|
function coordsAreValid(c) {
|
||||||
@@ -80,6 +79,7 @@ export default class ReplayCanvas3D {
|
|||||||
this.players = {}
|
this.players = {}
|
||||||
for (const p of data.players || []) this.players[p.id] = p
|
for (const p of data.players || []) this.players[p.id] = p
|
||||||
this.teamWon = data.teamWon
|
this.teamWon = data.teamWon
|
||||||
|
this.winnerSlot = Number(data.winnerSlot) || 0
|
||||||
|
|
||||||
this._buildEntities()
|
this._buildEntities()
|
||||||
this._buildCaptureModel()
|
this._buildCaptureModel()
|
||||||
@@ -466,32 +466,33 @@ export default class ReplayCanvas3D {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Step interpolation, matching the 2D engine's _interpSeries(series, t, true).
|
||||||
_captureValueAt(zone, t) {
|
_captureValueAt(zone, t) {
|
||||||
if (!zone.cap.length) return 0
|
const cap = zone.cap
|
||||||
if (t <= zone.cap[0][0]) return zone.cap[0][1]
|
if (!cap.length) return 0
|
||||||
for (let i = 1; i < zone.cap.length; i++) {
|
if (t <= cap[0][0]) return cap[0][1]
|
||||||
const prev = zone.cap[i - 1]
|
const last = cap[cap.length - 1]
|
||||||
const cur = zone.cap[i]
|
if (t >= last[0]) return last[1]
|
||||||
if (t <= cur[0]) {
|
for (let i = 1; i < cap.length; i++) {
|
||||||
const gap = cur[0] - prev[0]
|
if (cap[i][0] >= t) return cap[i - 1][1]
|
||||||
if (gap > CAP_INTERP_MAX_GAP_MS) return prev[1]
|
|
||||||
const alpha = (t - prev[0]) / Math.max(1, gap)
|
|
||||||
return THREE.MathUtils.lerp(prev[1], cur[1], THREE.MathUtils.clamp(alpha, 0, 1))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return zone.cap[zone.cap.length - 1][1]
|
return last[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateCaptureZones() {
|
_updateCaptureZones() {
|
||||||
for (const group of this.zoneGroup.children) {
|
for (const group of this.zoneGroup.children) {
|
||||||
const { zone, fill } = group.userData
|
const { zone, fill } = group.userData
|
||||||
if (!zone || !fill) continue
|
if (!zone || !fill) continue
|
||||||
const value = THREE.MathUtils.clamp(this._captureValueAt(zone, this.currentT), -100, 100)
|
// Same logic as the 2D engine: owner is slot 2 if value>0 else slot 1,
|
||||||
const amount = Math.abs(value) / 100
|
// coloured green when it matches the winning slot, red otherwise.
|
||||||
fill.visible = value !== 0
|
const value = this._captureValueAt(zone, this.currentT)
|
||||||
fill.material.color.set(value > 0 ? LOSE_COLOR : value < 0 ? WIN_COLOR : 0xd8dee9)
|
const frac = Math.min(1, Math.abs(value) / 100)
|
||||||
fill.material.opacity = value === 0 ? 0 : 0.18 + amount * 0.34
|
if (frac <= 0.01) { fill.visible = false; continue }
|
||||||
const s = value === 0 ? 0 : Math.sqrt(amount)
|
const ownerSlot = value > 0 ? 2 : 1
|
||||||
|
fill.visible = true
|
||||||
|
fill.material.color.set(ownerSlot === this.winnerSlot ? WIN_COLOR : LOSE_COLOR)
|
||||||
|
fill.material.opacity = 0.18 + frac * 0.34
|
||||||
|
const s = Math.sqrt(frac)
|
||||||
fill.scale.set(s, s, 1)
|
fill.scale.set(s, s, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user