Files
MateuusandClaude Opus 5.5 84f30bbc2d CenaForge: primeira versão pública
Gerador de vídeos narrativos (Godot + FFmpeg), painel Next.js, serviço de voz,
Clipador de lives e Publicador para YouTube, TikTok e Instagram.

Inclui a leitura das visualizações dos posts para o Dashboard e o botão
"Publicar no <rede>" nos cartões das publicações.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 16:35:09 -03:00

501 lines
22 KiB
GDScript

extends Node2D
## Desenho das cenas 2D do documentário. `apply(t)` guarda o tempo e redesenha;
## tudo depende só de (configuração, t), então o render é determinístico.
## Medidas proporcionais ao tamanho da tela: a mesma composição em 540x960 e 1080x1920.
##
## Modelos:
## title { title, subtitle?, kicker? }
## counter { value, decimals?, prefix?, suffix?, label?, note?, grid?: { cols, rows, highlight } }
## map { preset?: "litoral-sp", title?, markers: [{ label, lat?, lon?, kind?: "city"|"island" }],
## route?: { from, to, label? } } (from/to = rótulo ou índice do marcador)
const BG := Color("#0d0d10")
const BG_2 := Color("#1a120c")
const ACCENT := Color("#ff7a1a")
const GLOW := Color("#ffb547")
const TEXT := Color("#f5f2ee")
const MUTED := Color("#b8b0a8")
const SEA := Color("#0b1e2b")
const SEA_2 := Color("#0f2a3a")
const LAND := Color("#1f3326")
const LAND_EDGE := Color("#4f7a5a")
## Litoral sul e centro de São Paulo (ilustrativo, sem escala exata): pontos da costa de
## sudoeste para nordeste e um pequeno dicionário de lugares (lat, lon).
const PRESETS := {
"litoral-sp": {
"bounds": {"north": -23.35, "south": -24.95, "west": -47.65, "east": -45.75},
"coast": [
[-24.95, -47.65], [-24.80, -47.62], [-24.70, -47.52], [-24.55, -47.28], [-24.42, -47.10],
[-24.32, -47.00], [-24.25, -46.90], [-24.18, -46.79], [-24.12, -46.68], [-24.09, -46.62],
[-24.03, -46.48], [-24.01, -46.41], [-23.98, -46.37], [-23.99, -46.30], [-24.00, -46.25],
[-23.93, -46.18], [-23.85, -46.14], [-23.80, -45.98], [-23.77, -45.85], [-23.80, -45.75],
],
"places": {
"São Paulo": [-23.55, -46.63], "Santos": [-23.96, -46.33], "Guarujá": [-23.99, -46.26],
"São Vicente": [-23.96, -46.39], "Praia Grande": [-24.00, -46.42], "Mongaguá": [-24.09, -46.62],
"Itanhaém": [-24.18, -46.79], "Peruíbe": [-24.32, -47.00], "Bertioga": [-23.85, -46.14],
"Ilha da Queimada Grande": [-24.487, -46.674], "Queimada Grande": [-24.487, -46.674],
"Ilha da Queimada Pequena": [-24.375, -46.795], "Queimada Pequena": [-24.375, -46.795],
},
},
}
var _cfg: Dictionary
var _p: Dictionary
var _size := Vector2.ZERO
var _t := 0.0
var _dur := 1.0
var _font: SystemFont
var _font_regular: SystemFont
var _map_cache := {}
var _glow_tex: GradientTexture2D
func setup(cfg: Dictionary, viewport_size: Vector2) -> void:
_cfg = cfg
_p = cfg.params
_size = viewport_size
_dur = maxf(float(cfg.video.duration), 0.1)
_font = _make_font(800)
_font_regular = _make_font(500)
RenderingServer.set_default_clear_color(BG)
var g := Gradient.new()
g.set_color(0, Color(1, 1, 1, 1))
g.set_color(1, Color(1, 1, 1, 0))
g.add_point(0.45, Color(1, 1, 1, 0.32))
_glow_tex = GradientTexture2D.new()
_glow_tex.gradient = g
_glow_tex.fill = GradientTexture2D.FILL_RADIAL
_glow_tex.fill_from = Vector2(0.5, 0.5)
_glow_tex.fill_to = Vector2(1.0, 0.5)
_glow_tex.width = 512
_glow_tex.height = 512
if cfg.template == "map":
_map_cache = _prepare_map()
func apply(t: float) -> void:
_t = t
queue_redraw()
## Resumo do estado no instante atual (para o manifesto ser comparável entre execuções).
func state_signature() -> String:
return "%s|%.3f" % [_cfg.template, _ease_out(_progress(0.0, 1.0))]
func _make_font(weight: int) -> SystemFont:
var f := SystemFont.new()
f.font_names = PackedStringArray(["Segoe UI", "Segoe UI Variable Display", "Arial", "DejaVu Sans", "Liberation Sans"])
f.font_weight = weight
f.antialiasing = TextServer.FONT_ANTIALIASING_GRAY
return f
func _draw() -> void:
if _cfg.is_empty():
return
match str(_cfg.template):
"title":
_draw_title()
"counter":
_draw_counter()
"map":
_draw_map()
# ---------------------------------------------------------------- utilidades
func _progress(start: float, length: float) -> float:
return clampf((_t - start) / maxf(length, 0.001), 0.0, 1.0)
static func _ease_in_out(p: float) -> float:
return p * p * (3.0 - 2.0 * p)
static func _ease_out(p: float) -> float:
return 1.0 - pow(1.0 - p, 3.0)
func _px(fraction: float) -> int:
return int(round(_size.y * fraction))
func _background(top: Color, bottom: Color) -> void:
var r := Rect2(Vector2.ZERO, _size)
draw_polygon(PackedVector2Array([r.position, Vector2(r.end.x, 0), r.end, Vector2(0, r.end.y)]),
PackedColorArray([top, top, bottom, bottom]))
func _glow(center: Vector2, radius: float, color: Color) -> void:
# Brilho suave: textura de degradê radial (sem anéis em degrau).
draw_texture_rect(_glow_tex, Rect2(center - Vector2(radius, radius), Vector2(radius, radius) * 2.0), false, Color(color.r, color.g, color.b, color.a * 0.45))
## Texto (quebra por palavra) com o topo em `top_y`, centralizado ou alinhado à esquerda
## (margem de (1 - width_fraction) / 2). Devolve a altura usada.
func _text_block(text: String, top_y: float, size_px: int, color: Color, font: Font, width_fraction := 0.84, max_lines := 4, align := HORIZONTAL_ALIGNMENT_CENTER) -> float:
if text.is_empty():
return 0.0
var width := _size.x * width_fraction
var left := (_size.x - width) / 2.0
var block := font.get_multiline_string_size(text, align, width, size_px, max_lines)
var ascent := font.get_ascent(size_px)
draw_multiline_string(font, Vector2(left, top_y + ascent), text, align, width, size_px, max_lines, color)
return block.y
func _with_alpha(c: Color, a: float) -> Color:
return Color(c.r, c.g, c.b, c.a * clampf(a, 0.0, 1.0))
## Número no formato brasileiro: 1.500 / 0,0055.
static func _format_number(value: float, decimals: int) -> String:
var negative := value < 0.0
var v := absf(value)
var int_part := int(floor(v))
var frac := ""
if decimals > 0:
var scaled := int(round((v - float(int_part)) * pow(10.0, decimals)))
if scaled >= int(pow(10.0, decimals)):
int_part += 1
scaled = 0
frac = "," + str(scaled).pad_zeros(decimals)
var digits := str(int_part)
var grouped := ""
var count := 0
for i in range(digits.length() - 1, -1, -1):
grouped = digits[i] + grouped
count += 1
if count % 3 == 0 and i > 0:
grouped = "." + grouped
return ("-" if negative else "") + grouped + frac
# ---------------------------------------------------------------- título
## Cores de destaque por variação ("gerar de novo"): brasa, ciano, violeta.
const VARIANT_ACCENTS := [Color("#ff7a1a"), Color("#3fc1c9"), Color("#a78bfa")]
func _variant() -> int:
return int(_p.get("variant", 0))
func _accent() -> Color:
return VARIANT_ACCENTS[_variant() % VARIANT_ACCENTS.size()]
func _draw_title() -> void:
match _variant() % 3:
1:
_draw_title_editorial()
2:
_draw_title_lower()
_:
_draw_title_center()
## Variação 1: editorial, alinhado à esquerda, barra vertical de destaque.
func _draw_title_editorial() -> void:
var accent := _accent()
_background(BG, BG_2)
_glow(Vector2(_size.x * 0.15, _size.y * 0.35), _size.x * 0.8, Color(accent.r, accent.g, accent.b, 0.5))
var appear := _ease_out(_progress(0.15, 0.7))
var bar := _ease_out(_progress(0.0, 0.7))
var x0 := _size.x * 0.08
var top := _size.y * 0.3
var y := top + (1.0 - appear) * _px(0.02)
var kicker := str(_p.get("kicker", ""))
if not kicker.is_empty():
y += _text_block(kicker.to_upper(), y, _px(0.022), _with_alpha(accent, appear), _font, 0.78, 1, HORIZONTAL_ALIGNMENT_LEFT) + _px(0.02)
var h := _text_block(str(_p.get("title", "")), y, _px(0.066), _with_alpha(TEXT, appear), _font, 0.78, 5, HORIZONTAL_ALIGNMENT_LEFT)
draw_rect(Rect2(Vector2(x0, top), Vector2(_px(0.007), (y - top + h) * bar)), accent)
var sub_appear := _ease_out(_progress(0.55, 0.7))
_text_block(str(_p.get("subtitle", "")), y + h + _px(0.03), _px(0.03), _with_alpha(MUTED, sub_appear), _font_regular, 0.78, 3, HORIZONTAL_ALIGNMENT_LEFT)
## Variação 2: texto grande na parte de baixo-centro, sublinhado que corre, brilho embaixo.
func _draw_title_lower() -> void:
var accent := _accent()
_background(BG_2, BG)
_glow(Vector2(_size.x * 0.5, _size.y * 0.62), _size.x * 0.9 * (1.0 + 0.05 * sin(_t * 1.1)), Color(accent.r, accent.g, accent.b, 0.55))
var appear := _ease_out(_progress(0.1, 0.8))
var y := _size.y * 0.44 + (1.0 - appear) * _px(0.04)
var kicker := str(_p.get("kicker", ""))
if not kicker.is_empty():
y += _text_block(kicker.to_upper(), y, _px(0.022), _with_alpha(accent, appear), _font, 0.8, 1) + _px(0.02)
y += _text_block(str(_p.get("title", "")), y, _px(0.07), _with_alpha(TEXT, appear), _font, 0.88, 4) + _px(0.02)
var line := _ease_out(_progress(0.5, 0.8))
draw_rect(Rect2(Vector2(_size.x * 0.5 - _size.x * 0.25 * line, y), Vector2(_size.x * 0.5 * line, _px(0.005))), accent)
var sub_appear := _ease_out(_progress(0.7, 0.7))
_text_block(str(_p.get("subtitle", "")), y + _px(0.03), _px(0.03), _with_alpha(MUTED, sub_appear), _font_regular, 0.8, 3)
## Variação 0: centralizado, barra que cresce do centro.
func _draw_title_center() -> void:
_background(BG, BG_2)
var breathe := 1.0 + 0.04 * sin(_t * 1.3)
_glow(Vector2(_size.x * 0.5, _size.y * 0.42), _size.x * 0.75 * breathe, Color(ACCENT.r, ACCENT.g, ACCENT.b, 0.55))
var appear := _ease_out(_progress(0.15, 0.7))
var slide := (1.0 - appear) * _size.y * 0.03
var y := _size.y * 0.36 + slide
var kicker := str(_p.get("kicker", ""))
if not kicker.is_empty():
y += _text_block(kicker.to_upper(), y, _px(0.022), _with_alpha(GLOW, appear), _font, 0.8, 1) + _px(0.02)
# Barra de destaque que cresce do centro.
var bar := _ease_out(_progress(0.0, 0.6))
var bar_w := _size.x * 0.36 * bar
draw_rect(Rect2(Vector2((_size.x - bar_w) / 2.0, y), Vector2(bar_w, _px(0.006))), ACCENT)
y += _px(0.035)
y += _text_block(str(_p.get("title", "")), y, _px(0.058), _with_alpha(TEXT, appear), _font, 0.84, 4) + _px(0.025)
var sub_appear := _ease_out(_progress(0.55, 0.7))
_text_block(str(_p.get("subtitle", "")), y + (1.0 - sub_appear) * _px(0.015), _px(0.03), _with_alpha(MUTED, sub_appear), _font_regular, 0.8, 3)
# ---------------------------------------------------------------- contador / infográfico
func _draw_counter() -> void:
var accent := _accent()
_background(BG, BG_2)
_glow(Vector2(_size.x * 0.5, _size.y * 0.33), _size.x * 0.6, Color(accent.r, accent.g, accent.b, 0.5))
var value := float(_p.get("value", 0))
var decimals := int(_p.get("decimals", 0))
var count_len := clampf(_dur * 0.45, 0.8, 2.4)
var shown := value * _ease_out(_progress(0.2, count_len))
var number := str(_p.get("prefix", "")) + _format_number(shown, decimals) + str(_p.get("suffix", ""))
var pop := _ease_out(_progress(0.0, 0.5))
var grid_mode := typeof(_p.get("grid")) == TYPE_DICTIONARY
# Anel que fecha enquanto o número conta (sem grade: o anel é o elemento visual do infográfico).
var ring_center := Vector2(_size.x * 0.5, _size.y * (0.27 if grid_mode else 0.36))
var ring_r := _size.x * (0.27 if grid_mode else 0.33)
var fill := _ease_out(_progress(0.2, count_len))
draw_arc(ring_center, ring_r, 0.0, TAU, 128, Color(1, 1, 1, 0.07 * pop), _px(0.012), true)
draw_arc(ring_center, ring_r, -PI / 2.0, -PI / 2.0 + TAU * fill, 128, _with_alpha(accent, pop), _px(0.012), true)
if fill > 0.0:
var tip := ring_center + Vector2(cos(-PI / 2.0 + TAU * fill), sin(-PI / 2.0 + TAU * fill)) * ring_r
draw_circle(tip, _px(0.011), _with_alpha(accent.lightened(0.35), pop))
var size_px := int(_px(0.12 if number.length() <= 4 else 0.095) * (0.85 + 0.15 * pop))
var number_h := _font.get_multiline_string_size(number, HORIZONTAL_ALIGNMENT_CENTER, _size.x * 0.6, size_px, 1).y
var kicker := str(_p.get("kicker", ""))
if not kicker.is_empty():
_text_block(kicker, ring_center.y - number_h * 0.5 - _px(0.04), _px(0.028), _with_alpha(MUTED, pop), _font_regular, 0.5, 1)
_text_block(number, ring_center.y - number_h * 0.5, size_px, _with_alpha(accent.lightened(0.3), pop), _font, 0.6, 1)
var label_appear := _ease_out(_progress(0.35, 0.6))
var y := ring_center.y + ring_r + _px(0.035)
y += _text_block(str(_p.get("label", "")), y, _px(0.036), _with_alpha(TEXT, label_appear), _font, 0.84, 2) + _px(0.03)
var grid = _p.get("grid")
if typeof(grid) == TYPE_DICTIONARY:
_draw_grid(grid, y)
else:
var note_appear := _ease_out(_progress(0.9, 0.7))
_text_block(str(_p.get("note", "")), y + _px(0.02), _px(0.028), _with_alpha(MUTED, note_appear), _font_regular, 0.8, 4)
func _draw_grid(grid: Dictionary, top: float) -> void:
var cols := clampi(int(grid.get("cols", 10)), 1, 30)
var rows := clampi(int(grid.get("rows", 10)), 1, 30)
var highlight := clampi(int(grid.get("highlight", 1)), 0, cols * rows)
var area_w := _size.x * 0.72
var area_h := _size.y * 0.86 - top
var cell := minf(area_w / cols, area_h / rows)
var origin := Vector2((_size.x - cell * cols) / 2.0, top)
var total := cols * rows
var fill_len := clampf(_dur * 0.3, 0.6, 1.8)
for i in total:
var col := i % cols
var row := i / cols
# Células aparecem em onda (diagonal); as destacadas acendem depois.
var appear := _ease_out(_progress(0.6 + float(col + row) / float(cols + rows) * fill_len, 0.3))
if appear <= 0.0:
continue
var r := Rect2(origin + Vector2(col * cell, row * cell), Vector2(cell, cell)).grow(-cell * 0.12)
var is_hl := i < highlight
var lit := _ease_out(_progress(0.6 + fill_len + 0.2 + float(i) * 0.04, 0.35)) if is_hl else 0.0
var base := Color(1, 1, 1, 0.10 * appear)
draw_rect(r, base.lerp(Color(ACCENT.r, ACCENT.g, ACCENT.b, appear), lit))
var note_appear := _ease_out(_progress(0.6 + fill_len + 0.6, 0.6))
_text_block(str(_p.get("note", "")), origin.y + cell * rows + _px(0.02), _px(0.026), _with_alpha(MUTED, note_appear), _font_regular, 0.84, 3)
# ---------------------------------------------------------------- mapa
func _prepare_map() -> Dictionary:
var preset: Dictionary = PRESETS.get(str(_p.get("preset", "litoral-sp")), PRESETS["litoral-sp"])
var places: Dictionary = preset.places
# 1) Lugares citados (lat/lon dados ou do dicionário do preset).
var resolved := []
for m in _p.get("markers", []):
if typeof(m) != TYPE_DICTIONARY:
continue
var label := str(m.get("label", ""))
var lat = m.get("lat")
var lon = m.get("lon")
if (lat == null or lon == null) and places.has(label):
lat = places[label][0]
lon = places[label][1]
if lat == null or lon == null:
continue
var lower := label.to_lower()
var kind := str(m.get("kind", "island" if lower.contains("ilha") or lower.contains("queimada") else "city"))
resolved.append({"label": label, "lat": float(lat), "lon": float(lon), "kind": kind})
# 2) Enquadramento: em volta dos lugares citados (com folga), ou o preset inteiro.
var b: Dictionary = preset.bounds.duplicate()
if not resolved.is_empty():
var n := -90.0
var s_ := 90.0
var w := 180.0
var e := -180.0
for m in resolved:
n = maxf(n, m.lat)
s_ = minf(s_, m.lat)
w = minf(w, m.lon)
e = maxf(e, m.lon)
var pad_lat := maxf((n - s_) * 0.7, 0.22)
var pad_lon := maxf((e - w) * 0.7, 0.22)
b = {"north": n + pad_lat, "south": s_ - pad_lat, "west": w - pad_lon, "east": e + pad_lon}
var area := Rect2(Vector2(_size.x * 0.06, _size.y * 0.2), Vector2(_size.x * 0.88, _size.y * 0.62))
var mid_lat := deg_to_rad((float(b.north) + float(b.south)) / 2.0)
var span_x := (float(b.east) - float(b.west)) * cos(mid_lat)
var span_y := float(b.north) - float(b.south)
var scale := minf(area.size.x / span_x, area.size.y / span_y)
var offset := area.position + (area.size - Vector2(span_x, span_y) * scale) / 2.0
var project := func(lat: float, lon: float) -> Vector2:
return offset + Vector2((lon - float(b.west)) * cos(mid_lat), float(b.north) - lat) * scale
var coast := PackedVector2Array()
for pt in preset.coast:
coast.append(project.call(float(pt[0]), float(pt[1])))
# Terra = costa + cantos do norte (a costa paulista corre de sudoeste para nordeste).
var pb: Dictionary = preset.bounds
var land := coast.duplicate()
# Cantos bem além da tela: no começo do voo o mapa aparece aberto (zoom 0,45).
land.append(project.call(float(pb.south) - 1.0, float(pb.east) + 8.0))
land.append(project.call(float(pb.north) + 8.0, float(pb.east) + 8.0))
land.append(project.call(float(pb.north) + 8.0, float(pb.west) - 8.0))
land.append(project.call(float(pb.south) - 8.0, float(pb.west) - 8.0))
var markers := []
for m in resolved:
markers.append({"label": m.label, "pos": project.call(m.lat, m.lon), "lat": m.lat, "lon": m.lon, "kind": m.kind})
var route := {}
var r = _p.get("route")
if typeof(r) == TYPE_DICTIONARY and markers.size() >= 2:
var a := _find_marker(markers, r.get("from", 0))
var z := _find_marker(markers, r.get("to", 1))
if a >= 0 and z >= 0 and a != z:
var label := str(r.get("label", ""))
if label.is_empty():
label = "%d km" % int(round(_haversine_km(markers[a].lat, markers[a].lon, markers[z].lat, markers[z].lon)))
route = {"a": markers[a].pos, "b": markers[z].pos, "label": label}
var focus: Vector2 = area.get_center()
if not route.is_empty():
focus = (route.a + route.b) / 2.0
return {"coast": coast, "land": land, "markers": markers, "route": route, "focus": focus}
static func _find_marker(markers: Array, key) -> int:
if typeof(key) in [TYPE_INT, TYPE_FLOAT]:
var i := int(key)
return i if i >= 0 and i < markers.size() else -1
for i in markers.size():
if markers[i].label == str(key):
return i
return -1
static func _haversine_km(lat1: float, lon1: float, lat2: float, lon2: float) -> float:
var d_lat := deg_to_rad(lat2 - lat1)
var d_lon := deg_to_rad(lon2 - lon1)
var a := sin(d_lat / 2.0) ** 2 + cos(deg_to_rad(lat1)) * cos(deg_to_rad(lat2)) * sin(d_lon / 2.0) ** 2
return 6371.0 * 2.0 * atan2(sqrt(a), sqrt(1.0 - a))
func _draw_map() -> void:
_background(SEA_2, SEA)
var m := _map_cache
# Voo: começa aberto (litoral inteiro) e desce até a rota; depois aproxima devagar.
var focus: Vector2 = m.focus
var center := _size / 2.0
var intro := _ease_in_out(_progress(0.0, minf(1.6, _dur * 0.35)))
var start_zoom := 0.45 if _variant() % 2 == 0 else 0.62
var zoom := lerpf(start_zoom, 1.0, intro) + 0.1 * _ease_out(_progress(1.6, maxf(_dur - 1.6, 0.1)))
var pivot := center.lerp(focus, intro)
var shift := (center - focus) * 0.3 * intro
draw_set_transform(pivot - pivot * zoom + shift, 0.0, Vector2(zoom, zoom))
# Ondas do mar: linhas horizontais suaves que deslizam.
for i in 18:
var y := _size.y * (0.05 + float(i) * 0.055) + fmod(_t * 6.0, _size.y * 0.055)
draw_line(Vector2(0, y), Vector2(_size.x, y), Color(1, 1, 1, 0.025), 2.0)
var land_alpha := _ease_out(_progress(0.0, 0.6))
draw_colored_polygon(m.land, _with_alpha(LAND, land_alpha))
draw_polyline(m.coast, _with_alpha(LAND_EDGE, land_alpha), maxf(2.0, _size.y * 0.002), true)
var route: Dictionary = m.route
if not route.is_empty():
# A linha só começa quando o voo termina (1,5 s).
var route_len := clampf(_dur * 0.3, 0.8, 2.0)
var p := _ease_out(_progress(1.5, route_len))
var a: Vector2 = route.a
var b: Vector2 = route.b
var end := a.lerp(b, p)
# Linha tracejada que se desenha de A até B.
var dash := _size.y * 0.012
var length := a.distance_to(end)
var dir := (b - a).normalized()
var s := 0.0
while s < length:
draw_line(a + dir * s, a + dir * minf(s + dash, length), GLOW, maxf(3.0, _size.y * 0.003), true)
s += dash * 1.8
if p >= 1.0:
var lp := _ease_out(_progress(1.5 + route_len, 0.5))
# Pulso no destino: anéis que crescem e somem, a cada 1,2 s.
for k in 2:
var phase := fmod(maxf(_t - 1.5 - route_len, 0.0) + float(k) * 0.6, 1.2) / 1.2
draw_arc(b, _size.y * (0.012 + 0.04 * phase), 0.0, TAU, 48, Color(GLOW.r, GLOW.g, GLOW.b, 0.8 * (1.0 - phase) * lp), maxf(2.0, _size.y * 0.002), true)
var label := str(route.label)
var fs := _px(0.03)
var tw := _font.get_string_size(label, HORIZONTAL_ALIGNMENT_LEFT, -1, fs).x
# Ao lado da linha (perpendicular, para a direita), longe dos pontos.
var normal := Vector2(-dir.y, dir.x)
if normal.x < 0.0:
normal = -normal
var mid := (a + b) / 2.0 + normal * fs * 2.2
var box := Rect2(mid - Vector2(0, fs * 0.7), Vector2(tw + fs, fs * 1.4))
draw_rect(box, _with_alpha(Color(0, 0, 0, 0.7), lp))
draw_string(_font, box.position + Vector2(fs * 0.5, fs * 1.0), label, HORIZONTAL_ALIGNMENT_LEFT, -1, fs, _with_alpha(GLOW, lp))
var markers: Array = m.markers
for i in markers.size():
var mk: Dictionary = markers[i]
var pop := _ease_out(_progress(0.4 + float(i) * 0.25, 0.4))
if pop <= 0.0:
continue
var pos: Vector2 = mk.pos
var fs := _px(0.026)
if mk.kind == "island":
var r := _size.y * 0.012 * pop
draw_colored_polygon(PackedVector2Array([pos + Vector2(-r * 1.4, 0), pos + Vector2(-r * 0.6, -r), pos + Vector2(r * 0.8, -r * 0.8),
pos + Vector2(r * 1.5, r * 0.1), pos + Vector2(r * 0.5, r * 0.9), pos + Vector2(-r * 0.9, r * 0.7)]), Color(LAND_EDGE, pop))
draw_circle(pos, r * 2.6, Color(GLOW.r, GLOW.g, GLOW.b, 0.18 * pop))
else:
draw_circle(pos, _size.y * 0.007 * pop, Color(TEXT, pop))
draw_circle(pos, _size.y * 0.004 * pop, Color(ACCENT, pop))
var tw := _font.get_string_size(mk.label, HORIZONTAL_ALIGNMENT_LEFT, -1, fs).x
var right_side := pos.x + tw + fs < _size.x * 0.95
var text_pos := pos + (Vector2(fs * 0.8, fs * 0.35) if right_side else Vector2(-tw - fs * 0.8, fs * 0.35))
if mk.kind == "island":
# Ilha: nome centralizado embaixo (no mar), sem cruzar a costa.
text_pos = pos + Vector2(-tw / 2.0, _size.y * 0.035 + fs * 0.6)
text_pos.x = clampf(text_pos.x, _size.x * 0.03, _size.x * 0.97 - tw)
draw_string(_font, text_pos + Vector2(2, 2), mk.label, HORIZONTAL_ALIGNMENT_LEFT, -1, fs, Color(0, 0, 0, 0.6 * pop))
draw_string(_font, text_pos, mk.label, HORIZONTAL_ALIGNMENT_LEFT, -1, fs, Color(TEXT, pop))
draw_set_transform(Vector2.ZERO, 0.0, Vector2.ONE)
# Título no alto e aviso de mapa ilustrativo (fora do zoom).
var title := str(_p.get("title", ""))
if not title.is_empty():
_text_block(title, _size.y * 0.07, _px(0.04), Color(TEXT, _ease_out(_progress(0.1, 0.6))), _font, 0.86, 2)
draw_string(_font_regular, Vector2(_size.x * 0.05, _size.y * 0.965), "Mapa ilustrativo", HORIZONTAL_ALIGNMENT_LEFT, -1, _px(0.016), Color(1, 1, 1, 0.45))