mirror of
https://github.com/kennethreitz/rhymepad.org.git
synced 2026-06-11 17:08:33 +00:00
Per-word brightness: anchors glow, slant attachments whisper
Strength is now per token, not per family — a word that only slant- matches its family (placement riding creation/elation's -ation core) caps at 0.6 while the perfect anchors stay at 1.0. The gradient now lives within a single color, showing each word's own grip on the rhyme. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1325,9 +1325,14 @@ def analyze(draft: Draft):
|
||||
for t in [*tokens, *phrases]:
|
||||
if t["gid"] is None:
|
||||
continue
|
||||
gstr = groups_out[t["gid"]]["strength"]
|
||||
# a member that only slant-matches its family glows less than the
|
||||
# anchors that define it
|
||||
tstr = min(gstr, 0.6) if t["slant"] else gstr
|
||||
d = {"l": t["line"], "s": t["start"], "e": t["end"], "g": t["gid"],
|
||||
"end": t["is_end"], "ph": "vowels" in t,
|
||||
"slant": t["slant"] or groups_out[t["gid"]]["slant"]}
|
||||
"slant": t["slant"] or groups_out[t["gid"]]["slant"],
|
||||
"str": round(tstr, 2)}
|
||||
if "vowels" not in t: # single word: where its rhyming tail starts
|
||||
d["rs"] = t["start"] + rhyme_char_start(t["word"])
|
||||
toks_out.append(d)
|
||||
|
||||
+3
-3
@@ -636,8 +636,8 @@ function render(){
|
||||
: (p && (focusGid === null || p.g === focusGid)) ? p
|
||||
: (w || p);
|
||||
let alpha = !t.ph ? (t.end ? 34 : 19) : (t.end ? 24 : 14);
|
||||
const str = (groupInfo[t.g] && groupInfo[t.g].strength) || 1;
|
||||
alpha = Math.round(alpha * (0.45 + 0.55 * str)); // brightness = rhyme strength
|
||||
const str = t.str != null ? t.str : ((groupInfo[t.g] && groupInfo[t.g].strength) || 1);
|
||||
alpha = Math.round(alpha * (0.4 + 0.6 * str)); // brightness = this word's rhyme strength
|
||||
if(focusGid !== null && t.g === focusGid){
|
||||
alpha = Math.min(85, Math.round(alpha * 2.8));
|
||||
style += 'color:#1a120c;font-weight:600;'; // dark ink on the lit chip
|
||||
@@ -646,7 +646,7 @@ function render(){
|
||||
// faint underline on the rhyming tail (rs..e) of a word — a
|
||||
// whisper of precision under the full-word fill
|
||||
if(w && w.rs != null && a >= w.rs){
|
||||
const u = Math.round(42 * ((groupInfo[w.g] && groupInfo[w.g].strength) || 1));
|
||||
const u = Math.round(42 * (w.str != null ? w.str : 1));
|
||||
shadows.push(`inset 0 -1.5px 0 0 color-mix(in srgb, ${colorOf(w)} ${u}%, transparent)`);
|
||||
}
|
||||
}else if(op){
|
||||
|
||||
Reference in New Issue
Block a user