June 2015
Beginner
354 pages
8h 23m
English
We will use the function to create a timer. The timer moves the ball a little bit every 30 milliseconds. We are going to also change the direction of the ball movement once it hits the playground edge. Let's make the ball move now:
js/pingpong.js file in the text editor.pingpong.playground object, we change to the following code that adds height and width to the playground.playground: {
offsetTop: $("#playground").offset().top,
height: parseInt($("#playground").height()),
width: parseInt($("#playground").width()),
},Read now
Unlock full access