Jump to content

User:Ember314/follow.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*** this is a simple script that uses p5js to add an object that follows your cursor
 * use as you like
 * see if I care
 ***/
$('body').prepend('<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.min.js" integrity="sha512-WJXVjqeINVpi5XXJ2jn0BSCfp0y80IKrYh731gLRnkAS9TKc5KNt/OfLtu+fCueqdWniouJ1ubM+VI/hbo7POQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>');
$('body').prepend("<div id='funCanvas'></div>");
$('body').prepend('<style>#funCanvas{  position: absolute; left: 0; right: 0;top: 0;bottom: 0;height: 200%;width: 100%; z-index: 1000000;pointer-events: none; overflow: auto;}</style>');
var sketchHeight,
	sketchWidth;
function setup() {
	  sketchWidth = document.getElementById("funCanvas").offsetWidth;
  sketchHeight = document.getElementById("funCanvas").offsetHeight;
    var canvas = createCanvas(sketchWidth, sketchHeight);
    canvas.parent('funCanvas');
}

function draw() {
	//clear() /*optional*/
    circle(mouseX,mouseY,50,50);
}