Facebook // Notes // Does this have to be a farm? Can it be monster ranch? etc? // Notes about this // Can make it so the select stuff IU to place things os out of the cavnas, eg selecting seeds etc let gridWidth, gridHeight; let cellSize = 30; let offsetX = 0, offsetY = 0; let targetOffsetX = 0, targetOffsetY = 0; // Target offsets for smooth scrolling let gridColors; // Array to store colors let scrollSmoothingFactor = 0.2; function setup() { createCanvas(700, 700); gridWidth = 800; gridHeight = 800; } function draw() { background(220); // Smoothly update the offsets offsetX += (targetOffsetX - offsetX) * scrollSmoothingFactor; offsetY += (targetOffsetY - offsetY) * scrollSmoothingFactor; translate(-offsetX, -offsetY); // Draw the grid using stored colors for (let x = 0; x < gridWidth; x += cellSize) { for (let y = 0; y < gridHeight; y += cellSize) { stroke(0); rect(x, y, cellSize, cellSize); } } } function mouseDragged() { // Update target offsets based on mouse movement targetOffsetX -= mouseX - pmouseX; targetOffsetY -= mouseY - pmouseY; }
Logo

// Notes // Does this have to be a farm? Can it be monster ranch? etc? // Notes about this // Can make it so the select stuff IU to place things os out of the cavnas, eg selecting seeds etc let gr...

クレジット
Avatar
Illustrator
// Notes  // Does this have to be a farm? Can it be monster ranch? etc?   // Notes about this // Can make it so the select stuff IU to place things os out of the cavnas, eg selecting seeds etc  let gridWidth, gridHeight; let cellSize = 30; let offsetX = 0, offsetY = 0; let targetOffsetX = 0, targetOffsetY = 0; // Target offsets for smooth scrolling let gridColors; // Array to store colors let scrollSmoothingFactor = 0.2;  function setup() {   createCanvas(700, 700);   gridWidth = 800;   gridHeight = 800; }  function draw() {   background(220);    // Smoothly update the offsets   offsetX += (targetOffsetX - offsetX) * scrollSmoothingFactor;   offsetY += (targetOffsetY - offsetY) * scrollSmoothingFactor;    translate(-offsetX, -offsetY);    // Draw the grid using stored colors   for (let x = 0; x < gridWidth; x += cellSize) {     for (let y = 0; y < gridHeight; y += cellSize) {       stroke(0);       rect(x, y, cellSize, cellSize);     }   } }  function mouseDragged() {   // Update target offsets based on mouse movement   targetOffsetX -= mouseX - pmouseX;   targetOffsetY -= mouseY - pmouseY; }-1
シェア
Russell Careyの他の作品
画像
作品を見る
font-size: 18px; colo...
画像
作品を見る
sdfghj
画像
作品を見る
sdfsdfsd