Facebook
From Idiotic Sloth, 2 Years ago, written in Plain Text.
This paste is a reply to Untitled from Lousy Tamarin - go back
Embed
Viewing differences between Untitled and Re: Untitled
let x = 320;
let y = 180;
let xspeed = 5;
let yspeed = 2;

let r = 25;

function setup() {
  createCanvas(640, 360);
}

function draw() {
  background(0);
  
  
  let d = dist(x, y, mouseX, mouseY);
  if(d > 25){
    fill(255,0,0)
  }else{
    fill(0,0,255)
  }
  ellipse(x, y, r*2, r*2);
  
  
  // console.log(d)
  x += xspeed;
  y += yspeed;
  if (x > width - r || x < r) {
    xspeed = -xspeed;
  }
  if (y > height - r || y < r) {
    yspeed = -yspeed;
  }


}

Replies to Re: Untitled rss

Title Name Language When
Re:dingdong joe javascript 2 Years ago.