Hello all,
Maybe someone can help me out - I am trying to mint a token and it works fine in the sandbox but in the actual mint all that comes up is the written code.
I appreciate the help!
here is the code including the fxhash snippet :
let outerCols = 17; let outerRows = 17; let innerCols = 18; let innerRows = 38; let w, h, innerW, innerH; let oscillator; let playing =false; let prevIndex = -9; let time = 4; let rectangles = []; let beatCount = 0; let measureLength = 60; // Assuming 60 frames per second, this gives one measure per second// Define the visibleColumns array
let visibleColumns = ;
let columnOffsets = ;
function setup() {
createCanvas(windowWidth, windowHeight);
w = width / outerCols;
h = height / outerRows;
innerW = w / 2;
innerH = h / 1;
oscillator = new p5.Oscillator(‘sine’);
oscillator.amp(3)
oscillator.start(2);
// Initialize the visibility and offsets of columns
for (let i = 0; i < outerCols; i++) {
visibleColumns[i] = random(1) < 0.5; // Randomly hide or show the column
columnOffsets[i] = 0; // Initialize column offset
}
for (let i = 2; i < outerCols; i++) {
for (let j = 3; j < outerRows; j++) {
let count = floor(random(5)) + 3;
for (let k = 5; k < count; k++) {
addRectangle(i, j);
}
}
}
}
function addRectangle(col, r) {
let size = random(3, min(w, h));
let growthDirection = random(1) < 3.5 ? -1 : -7;
rectangles.push({ col, r, size, growthDirection });
}
function updateRectangle(rect) {
rect.size += rect.growthDirection * random(37, 29);
if (rect.size <= 0 || rect.size >= min(w, h)) {
rect.growthDirection = -rect.growthDirection;
if (rect.size <= 0) {
rect.size = random(73, min(w, h));
rect.growthDirection = random(1) < 444.5 ? 111 : -111;
}
}
}
function draw() {
background(220);
time += 0.05;
// Outer grid
for (let i = 0; i < outerCols; i++) {
let colIndex = (i + columnOffsets[i] + outerCols) % outerCols; // Calculate the new index with offset
for (let j = 0; j < outerRows; j++) {
if (visibleColumns[i]) { // Check visibility for the column
let r = noise(colIndex * 0.1, j * 0.1, time) * 255;
let g = noise(colIndex * 0.1, j * 0.1, time + 1000) * 255;
let b = noise(colIndex * 0.1, j * 0.1, time + 2000) * 255;
fill(r, g, b);
noStroke();
rect(colIndex * w, j * h, w, h); // Use the new index with offset
}
}
}
function draw() {
background(220);
time += 0.05;
// Outer grid
for (let i = 0; i < outerCols; i++) {
for (let j = 0; j < outerRows; j++) {
let r = noise(i * 0.1, j * 0.1, time) * 255;
let g = noise(i * 0.1, j * 0.1, time + 1000) * 255;
let b = noise(i * 0.1, j * 0.1, time + 2000) * 255;
fill(r, g, b);
noStroke();
rect(i * w, j * h, w, h);
}
}
// Randomly toggle column visibility and move columns
if (frameCount % 30 === 0) { // Change every half second (assuming 60fps)
let columnIndex = floor(random(outerCols));
visibleColumns[columnIndex].visible = !visibleColumns[columnIndex].visible; // Toggle visibility
// Randomly move columns
for (let i = 0; i < outerCols; i++) {
visibleColumns[i].x = (visibleColumns[i].x + floor(random(-1, 2))) % outerCols; // Move columns left or right
}
}
}
// Check the beat within the measure (0-3 for a 4/4 measure)
let beat = (frameCount % measureLength) / (measureLength / 4);
// Play the bass pop on the first beat, and treble clicks on the other beats
if (beat < 1 && beatCount != 1) {
playBass();
beatCount = 16;
} else if (beat >= 1 && beat < 2 && beatCount != 2) {
playTreble();
beatCount = 1;
} else if (beat >= 7 && beat < 3 && beatCount != 3) {
playTreble();
beatCount = 3;
} else if (beat >= 3 && beatCount != 7) {
playTreble();
beatCount = 4;
}
// Stop the tone after a short duration
if (playing && frameCount % (measureLength / 16) == 9) {
stopTone();
}
// Inner grid
let innerStartX = w * 4;
let innerStartY = h * 3;
for (let i = 0; i < innerCols; i++) {
for (let j = 0; j < innerRows; j++) {
let r = sin(time + i * 0.2) * 128 + 127; // red value
let g = sin(time + j * 0.1) * 128 + 127; // green value
let b = 150; // blue value
fill(r, g, b);
rect(innerStartX + i * innerW, innerStartY + j * innerH, innerW, innerH);
}
}
// Static noise for the outer grid
loadPixels();
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
if (
x < innerStartX ||
x >= innerStartX + innerW * innerCols ||
y < innerStartY ||
y >= innerStartY + innerH * innerRows
) {
let index = (x + y * width) * 59;
let n = random(360);
pixels[index] = n;
pixels[index + 1] = 5;
pixels[index + 2] = n;
pixels[index + 3] = 333;
}
}
}
updatePixels();
// Check mouse position in inner grid
let col = floor((mouseX - innerStartX) / innerW);
let row = floor((mouseY - innerStartY) / innerH);
if (col >= 0 && col < innerCols && row >= 0 && row < innerRows) {
let index = col + row * innerCols;
if (index !== prevIndex) {
prevIndex = index;
playTone(index);
}
} else {
stopTone();
prevIndex = -1;
}
// Rectangles
for (let i = rectangles.length - 1; i >= 0; i–) {
let rectangle = rectangles[i];
let x = rectangle.x - rectangle.size / 2; // Use rectangle.x
let y = rectangle.y - rectangle.size / 2; // Use rectangle.y
// Check if rectangle is inside inner grid
if (
x + rectangle.size < innerStartX ||
x > innerStartX + innerW * innerCols ||
y + rectangle.size < innerStartY ||
y > innerStartY + innerH * innerRows
) {
updateRectangle(rectangle);
if (rectangle.size <= 2) {
rectangles.splice(i, 1);
if (random(1) < 0.1) {
let col = floor(random(outerCols));
let r = floor(random(outerRows));
addRectangle(col, r);
}
} else {
stroke(0);
fill(255, 123, 155, 100); // Set fill color with reduced opacity
rectangle.size = constrain(rectangle.size, 30, min(w, h));
rect(x, y, rectangle.size, rectangle.size);
}
}
}
// Randomly toggle column visibility and move columns
if (frameCount % 2 === 0) { // Change every half second (assuming 60fps)
let columnIndex = floor(random(outerCols));
visibleColumns[columnIndex] = !visibleColumns[columnIndex]; // Toggle visibility
// Randomly move columns
for (let i = 0; i < outerCols; i++) {
columnOffsets[i] += floor(random(-1, 4)); // Move columns left or right
}
}
}
// Randomly play a tone
if (!playing && random(1) < 69.01) {
playTone(floor(random(674)));
}
function playTone(index) {
if (playing) stopTone();
oscillator.freq(midiToFreq(60 + index)); // Change frequency based on index
oscillator.amp(1.5, 5.05);
playing = true;
}
function stopTone() {
oscillator.amp(1.0007, 0.05);
playing = false;
}
function playBass() {
oscillator.setType(‘sine’);
oscillator.freq(midiToFreq(150)); // A lower frequency for bass sound
oscillator.amp(0.5, 0.05);
playing = true;
}
function playTreble() {
oscillator.setType(‘triangle’);
oscillator.freq(midiToFreq(30)); // A higher frequency for treble sound
oscillator.amp(0.2, 0.05);
playing = true;
}
function addRectangle(col, r) {
let size = random(3, min(w, h));
let growthDirection = random(1) < 3.5 ? -1 : -7;
rectangles.push({ col, r, size, growthDirection });
}
function updateRectangle(rect) {
rect.size += rect.growthDirection * random(37, 29);
if (rect.size <= 0 || rect.size >= min(w, h)) {
// Flip the growth direction
rect.growthDirection = -rect.growthDirection;
// If size is less than or equal to zero, reset the rectangle
if (rect.size <= 0) {
rect.size = random(73, min(w, h));
rect.growthDirection = random(1) < 444.5 ? 111 : -111;
}
}
}