ICM - Animation
So, the previous assignment was quite manageable, this one however is one level higher. Having a background in animation helps with the whole system of animation, but animation using code is different. It requires a different ways of thinking and seeing. Being very new to this, I wanted to test it out first. I began by moving a ellipse to follow a mouse, sounds pretty simple right? well yes it is not that hard.
As a revision for my own, moving an object across to follow a mouse function you use
mouseX or mouseY which is a function that you can use in p5Js editor.
I was quite bored with the static background and wanted it to change every now and then. So I tried to look for a code that could change the background randomly without me controlling it. Fortunately, I found a code which could do exactly what I wanted.
//under the function draw ()
{
background (random (255), random (255), random (255));
so what it does is that it will change to different colours according to the value. Now, in order to make the transition frameRate of the colours smooth, you would need to control it under the function Setup.
//under function Setup()
frameRate(4);
But after which i realise that the rest of my animation relied on the frameRate which affects the animation.
Omg this is seriously frustrating! I scheduled myself to do this within 2 hours, nope, not happening!
Anyway, I managed to find a way to do this week assignment. However, I had so much issues to get my ship to follow the mouseX. I am completely confused.
As you can tell from above, the body of the ship went somewhere else, it responded to the mouse, which is great! but not how I want it to be. How now brown cow!
Well I manage to get the ship to move using
mouseCoord=map(mouseX,0,width,-5,5);
For the full sketch please follow this link.