Question: I have a few questions regarding a computer science project using p 5 . js coding website. 1 . how can i code for an
I have a few questions regarding a computer science project using pjs coding website.
how can i code for an image to become smaller as the mouse is pressed closer to the yaxis midline?
my goal: i want to do stars in the sky each time the mouse is pressed, stars are drawn it is also a requirement to use the 'random' function, so i want the amount of stars drawn to be random.
"The size of the added objects should depend linearly upon the distance from the mouse click and the horizon. That is an object that is twice as far from the horizon should be drawn twice as big, and this means that the drawn size shrinks to near zero size as objects approach the horizon."
on the bottom half, id like to do little bundles of blades of grass, blades when mouse is pressed. same as above, as it approaches the horizon, it decreases in size.
the next requirement is when key r is pressed, the in my case stars and blades of grass disappear and the original background remains. is there a shorter way to do this rather than copying and pasting the entire function setup under function keyPressed?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
