Thursday, April 30, 2020

forth hour of the ten hours of programming (infotech)

forth hour of the ten hours of programming
so today i was learning animation basics! finally!
an animation is a bunch of drawing all flipping in a sequence to make the objects or pictures move. so the first new command we are learning is the "draw = function( )  { " which makes all lines of code inside run repeatedly. so we put our picture's code into the draw function space and move "var" to the outside on top, that way it always starts there, then add a new command to change the existing var with whatever command we need it to move, example:
var x = 10;
draw -function( ) {
(whatever the code for the picture is)
x = x + 1;
 };
that way we get to replay that function over and over again.
now i have a challenge to do, the exploding sun.
i did forget to put the first var outside the draw function but i got it in the end.  i made the small animation which was just making the sun get bigger.
we also learned a few shortcuts. so instead of writing
 x + x = 2;
we can just write
x + = 2;
and also programmers like to write + 1 a lot so they came up with an easier way of writing that all the time just by writing ++.
then we had another challenge, parting clouds challenge. and i had a bit of trouble at first but i got it in the end. so what i did was just make the clouds go in the opposite direction of the sun which was getting bigger and bigger.
so i spent a lot of time trying ti figure out what i did wrong in the challenge that i didn't have enough time to start of the project so ill do that later and also start on the interactive programs.

No comments:

Post a Comment