Image
Code

Fork of Mouse Follower

char0496

Last edited Apr 16, 2022
Created on Apr 15, 2022
Forked from Mouse Follower

A program that follows your mouse with a circle.

When this code runs we have the initial mouse position to be a object of propertes x and y. the first time this app is render we pass in initial mouse position to use stae, that initialetes state value. we take mouse posotivion to define cx and cy. the mousemove event is register with a come back function named handlemousemove

the event object uses it. then we make a new state object and we pass it to setmpouseposition

when we invoke setmouseposotion our state chnages and the app is re-render

usecalback, wrap the definition inside first argument, the function second, an array of thngs this function needs to run

MIT Licensed