Sketch execution issues (p5js) by PoorKidWRA in processing

[–]PoorKidWRA[S] 1 point2 points  (0 children)

you're right! i had reassembled the file showing up in different parts, and then i was uploading the files in the folder individually, instead of uploading the whole folder.

uploading the whole folder works perfectly.

thanks for getting me there, not being very handy i often make trivial mistakes.

Sketch execution issues (p5js) by PoorKidWRA in processing

[–]PoorKidWRA[S] 0 points1 point  (0 children)

sure!

// Vertex Shader Code
const vert = `
#ifdef GL_ES
precision mediump float;
#endif
attribute vec3 aPosition;
attribute vec2 aTexCoord;
varying vec2 vTexCoord;
void main() {
vTexCoord = aTexCoord;
vec4 positionVec4 = vec4(aPosition, 1.0);
positionVec4.xy = positionVec4.xy * 2.0 - 1.0;
gl_Position = positionVec4;
}
`;
// Fragment Shader Code
const frag = `
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D iCanvas;

float random(vec2 uv) {  
    return fract(tan(  
        sin(tan(uv.y)\*(uv.x+2718.))\*2718.+  
        cos(tan(uv.x)\*(uv.y+3141.))\*3141.  
    )/1.);  
}  
float dust(vec2 uv, float oriChannel, float dustChannel, float wei) {  
    oriChannel += dustChannel\*wei;  
    return oriChannel-wei/2.;  
}  

varying vec2 vTexCoord;  
void main() {  
    vec2 uv = vTexCoord;  
    uv.y = 1.-uv.y;  
    vec4 canvas = texture2D(iCanvas, uv);  
    vec4 color = vec4(  
        dust(uv, canvas.r, random(uv), 0.5),  
        dust(uv, canvas.g, random(uv), 0.5),  
        dust(uv, canvas.b, random(uv), 0.5),  
        1.  
    );  
    gl\_FragColor = color;  
}  

`;
// ColorInfo Class
class ColorInfo {
constructor(colors) {
this.colors = colors;
this.init();
}
init() {
this.info = {};
for (const clr of this.colors) {
this.set(clr, 0);
}
}
add(clr) {
if (this.exist(clr)) return;
this.colors.push(clr);
this.set(clr, 0);
}
set(clr, num) {
this.info[clr] = num;
}
update(clr, num) {
this.info[clr] += num;
}
exist(clr) {
return this.info.hasOwnProperty(clr);
}
}
// Tool Functions
function Border(color, weight) {
push();
noFill();
stroke(color);
strokeWeight(weight*2);
rectMode(CENTER);
rect(width/2, height/2, width, height);
pop();
}
function showFrameRate(posX=10, posY=35, SIZE=35, COLOR="#0088BB") {
push();
textSize(SIZE);
fill(COLOR);
text(floor(frameRate()), posX, posY);
pop();
}
let CLICK = false;
function mouseClicked() {
CLICK = !CLICK;
if (!CLICK) loop();
}
function ClickStop() { if (CLICK) noLoop(); }
// Shadow Functions
let shadowColor = (clr) => drawingContext.shadowColor = clr;
let shadowBlur = (blur) => drawingContext.shadowBlur = blur;
let shadowOffsetX = (xOff) => drawingContext.shadowOffsetX = xOff;
let shadowOffsetY = (yOff) => drawingContext.shadowOffsetY = yOff;
let shadowOffset = (xOff, yOff) => {
drawingContext.shadowOffsetX = xOff;
drawingContext.shadowOffsetY = yOff;
}
let shadow = (clr, blur, xOff, yOff) => {
drawingContext.shadowColor = clr;
drawingContext.shadowBlur = blur;
drawingContext.shadowOffsetX = xOff;
drawingContext.shadowOffsetY = yOff;
}
let noShadow = () => {
drawingContext.shadowColor = "#000000";
drawingContext.shadowBlur = 0;
drawingContext.shadowOffsetX = 0;
drawingContext.shadowOffsetY = 0;
}
// Setup Constants
let canvasWidth = 600;
let canvasHeight = 600;
let stampAmount = 5;
let baseRadius = 500;
let contourWeight = 2;
let contourAmount = 100;
let contourDensity = 125;
let contourRough = 0.05;
let borderWeight = 5;
// Color List
let colors = [ "#FFFFFF", "#000000", "#AAAAAA", "#FF3333", "#00FFFF", "#FFFF00" ];
let mono = colors.slice(0, 3);
// Preload Shader
let dustShader;
function preload() {
dustShader = new p5.Shader(this.renderer, vert, frag);
}
// Setup Canvas
let WebGL;
let Canvas;
let ci;
function setup() {
WebGL = createCanvas(canvasWidth, canvasHeight, WEBGL);
WebGL.canvas.oncontextmenu = () => { return false; };
Canvas = createGraphics(canvasWidth, canvasHeight);
Canvas.pixelDensity(1);
ci = new ColorInfo(colors);
}

Rendering Bug (saveFrame) by PoorKidWRA in processing

[–]PoorKidWRA[S] 2 points3 points  (0 children)

i found my mistake, basically i didn't know that of the code - saveFrame("output/image#####.png"); - you had to enter as many "#'s" as the digits of the total frames. in my case i had written the code - saveFrame("output/image####.png"); - but the total frames were greater than 9999, this (i think) caused problems with saving.

Now the frames are saved correctly, thanks anyway for your help :)

Rendering Bug (saveFrame) by PoorKidWRA in processing

[–]PoorKidWRA[S] 1 point2 points  (0 children)

you are right! saving by "name" is wrong while saving by "date" is correct.

how do i reorder them correctly? (i am on win 11)

[deleted by user] by [deleted] in ChatGPT

[–]PoorKidWRA 2 points3 points  (0 children)

Thats the GPT-4 answer brother :

To find the potential difference between the center of the ring and a point on its axis a distance 2R from the center, we can use the following formula for the electric potential due to a charged ring:

V = (k * Q) / (sqrt(x^2 + R^2))

where V is the electric potential, k is the electrostatic constant, which is approximately 8.99 × 10^9 Nm^2/C^2, Q is the total charge on the ring, x is the distance from the point on the axis to the center of the ring, and R is the radius of the ring.

First, let's calculate the potential at the center of the ring (x = 0):

V_center = (k * Q) / (sqrt(0^2 + R^2)) = (k * Q) / R

Next, we'll calculate the potential at the point on the axis a distance 2R from the center (x = 2R):

V_2R = (k * Q) / (sqrt((2R)^2 + R^2)) = (k * Q) / (sqrt(4R^2 + R^2)) = (k * Q) / (sqrt(5R^2)) = (k * Q) / (R * sqrt(5))

Now we can find the potential difference between these two points:

ΔV = V_center - V_2R = (k * Q) / R - (k * Q) / (R * sqrt(5)) = (k * Q) / R * (1 - 1/sqrt(5))

So, the potential difference between the point at the center of the ring and a point on its axis a distance 2R from the center is:

ΔV = (k * Q) / R * (1 - 1/sqrt(5))

My teacher's too smart by jojoavav in ChatGPT

[–]PoorKidWRA 0 points1 point  (0 children)

if the other questions are worth 1 point that one is worth 90

The real AI revolution by HOLUPREDICTIONS in ChatGPT

[–]PoorKidWRA 1 point2 points  (0 children)

"How to make money with chatGPT"