scene.org File Archive

File download

<root>­/­parties­/­2025­/­revision25­/­entropretty-tattoo/sakura-cherryblossom_revision-2025.zip

File size:
356 586 bytes (348.23K)
File date:
2025-04-20 15:40:02
Download count:
all-time: 0

Preview

  • revision2025-sakura-cherryblossom_by_funghi_tonleben.txt 5.76K
  • Sakura_screenshot.png 191.46K
  • Sakura_screenshot2.png 194.47K

file_id.diz

/** 
 * Entropretty competition Sakura Cherryblossom. 
 * cherryblossom fades, but revision compo entry stays forever
 * Thanks to all tonleben crew members - borg / air2k / uLtrA / dossi / tschieses
 * Created by Fabi - funghi/tonleben
 */

// Zentriere die Bluete in der Mitte
ctx.translate(50, 50);
ctx.textAlign = "center";
ctx.textBaseline = "middle";

// --- Blueten-Parameter (Stern) ---
const petalCount = 5; //Strahlenzahl
const petalSize = 40; //Größe

// -- Anzahl der Sterne → Bits 0 + 1 --
const starCountVariants = [2, 3, 4, 5];
const numStars = starCountVariants[bits(seed, 0, 2)];

// Rotationswinkel für Sterne
const baseRotations = [10, 25];
const rotationOffsets = {
  3: [7, 17.5, 28],
  4: [0, 10, 30, 40],
  5: [0, 10, 20, 30, 40]
};
const rotations = rotationOffsets[numStars] || baseRotations;

// -- Steilheit der Sternstrahlen → Bits 2 + 3 !!!
const radiusInnerFactor = [0.50, 0.65, 0.75];
const radiusInner = petalSize * radiusInnerFactor[bits(seed, 2, 4)];


// --- Sternform erstellen ---
function createStar(numPoints, radiusOuter, rotationAngle) {
  const points = [];
  const angleStep = (Math.PI * 2) / (numPoints * 2);

  for (let i = 0; i < numPoints * 2; i++) {
    const angle = i * angleStep + ((rotationAngle + 180) * Math.PI / 180);
    const radius = i % 2 === 0 ? radiusOuter : radiusInner;
    const x = Math.cos(angle) * radius;
    const y = Math.sin(angle) * radius;
    points.push({ x, y });
  }
  return points;
}

// --- Zeichnen der Bluetenblaetter ---
rotations.forEach(rotationOffset => {
  const starPoints = createStar(petalCount, petalSize, rotationOffset);
  ctx.beginPath();
  starPoints.forEach((point, index) => {
    if (index === 0) {
      ctx.moveTo(point.x, point.y);
    } else {
      ctx.lineTo(point.x, point.y);
    }
  });
  ctx.closePath();
  ctx.fillStyle = "pink";
  ctx.fill();
});

// --- Bluetenstempel zeichnen - Bits 4 ---
const stempelGroesseVarianten = [0, 4];
const stempelIndex = bits(seed, 4, 5);
const stempelGroesse = stempelGroesseVarianten[stempelIndex];

ctx.beginPath();
ctx.arc(0, 0, stempelGroesse, 0, Math.PI * 2);
ctx.fillStyle = "white";
ctx.fill();

const duenn = 1.5;
const dick = 3;
const kurzeLaenge = 12;
const langeLaenge = 16;

// --- Berechnung der Strahlenlaenge - Bits 6–13
const strahlLaengen = [
  (bits(seed, 6, 7) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 7, 8) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 8, 9) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 9, 10) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 10, 11) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 11, 12) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 12, 13) % 2 === 1) ? langeLaenge : kurzeLaenge,
  (bits(seed, 13, 14) % 2 === 1) ? langeLaenge : kurzeLaenge
];

// --- Berechnung der Strahldicke - Bits 24–31
const strahlenDicken = [
  (bits(seed, 24, 25) % 2 === 1) ? dick : duenn,
  (bits(seed, 25, 26) % 2 === 1) ? dick : duenn,
  (bits(seed, 26, 27) % 2 === 1) ? dick : duenn,
  (bits(seed, 27, 28) % 2 === 1) ? dick : duenn,,
  (bits(seed, 28, 29) % 2 === 1) ? dick : duenn,
  (bits(seed, 29, 30) % 2 === 1) ? dick : duenn,
  (bits(seed, 30, 31) % 2 === 1) ? dick : duenn,
  (bits(seed, 31, 32) % 2 === 1) ? dick : duenn,
];

// --- Winkel der Strahlen
const winkel = [0, 45, 90, 135, 180, 225, 270, 315];

// --- Strahlen zeichnen mit individuellen Dicken
for (let i = 0; i < 8; i++) {
  ctx.beginPath();
  ctx.moveTo(0, 0);
  ctx.lineTo(Math.cos(winkel[i] * Math.PI / 180) * strahlLaengen[i], Math.sin(winkel[i] * Math.PI / 180) * strahlLaengen[i]);
  ctx.strokeStyle = "white";
  ctx.lineWidth = strahlenDicken[i];
  ctx.stroke();
}

const kleinePunktGroesse = 2.5;
const grossePunktGroesse = 4;
const pinkPunktGroesse = 2;

// Farbvarianten für die Punkte - Bits 14 - 28 
const farbVarianten = [
  { sichtbar: false, color: "pink", innerColor: null },  // Unsichtbar (Pink)
  { sichtbar: true, color: "white", innerColor: null },  // Klein (Weiß)
  { sichtbar: true, color: "white", innerColor: "pink" }, // Weißer Kreis mit pinkem Punkt
  { sichtbar: true, color: "white", innerColor: null }  // Groß (Weiß)
];

let punktZustaende = [
  bits(seed, 14, 16) % 4, 
  bits(seed, 16, 18) % 4, 
  bits(seed, 18, 20) % 4, 
  bits(seed, 20, 22) % 4, 
  bits(seed, 22, 24) % 4, 
  bits(seed, 24, 26) % 4, 
  bits(seed, 4, 6) % 4, 
  bits(seed, 2, 4) % 4
];

for (let i = 0; i < 8; i++) {
  let x = Math.cos(winkel[i] * Math.PI / 180) * strahlLaengen[i];
  let y = Math.sin(winkel[i] * Math.PI / 180) * strahlLaengen[i];

  const punktInfo = farbVarianten[punktZustaende[i]];

  if (punktInfo.sichtbar) {
    ctx.beginPath();
    
    let punktGroesse = punktZustaende[i] === 3 
      ? grossePunktGroesse  // Grosser weisser Kreis 
      : punktZustaende[i] === 2 
        ? grossePunktGroesse  // Weisser Kreis mit pinkem Punkt
        : kleinePunktGroesse; // Alle anderen bleiben klein
    
    ctx.arc(x, y, punktGroesse, 0, Math.PI * 2);
    ctx.fillStyle = punktInfo.color;
    ctx.fill();

    // Falls es ein weisser Kreis mit pinkem Punkt sein soll
    if (punktInfo.innerColor) {
      ctx.beginPath();
      ctx.arc(x, y, pinkPunktGroesse, 0, Math.PI * 2);
      ctx.fillStyle = punktInfo.innerColor;
      ctx.fill();
    }
  }
}

// Bit 12 Position des zusaetzlichen Mittelpunktes
const centerpunktGroessePink = 3.5;
const centerpunktGroesseWeiss = 5;
const sichtbar2 = bits(seed, 12, 13) % 2 === 1;

if (sichtbar2) {
  ctx.beginPath();
  ctx.arc(0, 0, centerpunktGroesseWeiss, 0, Math.PI * 2);
  ctx.fillStyle = "white";
  ctx.fill();

  ctx.beginPath();
  ctx.arc(0, 0, centerpunktGroessePink, 0, Math.PI * 2);
  ctx.fillStyle = "pink";
  ctx.fill();

}