145,176 views
4 votes
4 votes
To Get Text to Move

1. Write the code to create a variable for the starting position of your text on

either the X or Y axis.

a. EX: var textStarts = 25;

2. Write the code to create the loop.

3. Write the code to create the text size.

4. Write the code to create the text color.

5. Write the code to create the text that you want to appear.

6. When you write the code for the text to appear, call the variable created in

step on for the X or Y location.

a. EX: text (“Moving text is simple!”, textStarts, 150);

7. Write the code to get the text to move.

a. EX: textStarts = textStarts – 6;

(JAVAscript)

User Martinsos
by
2.9k points

1 Answer

26 votes
26 votes
Today is your lucky day.. i do JavaScript, and i love coding! Happy to help. (I make games n things on Khan academy)

// make variable for x.
var startX = 0;

// start loop
draw = function() {

// if you needed to stop the text from smudging, you can add this: background(255, 255, 255);

// choose text size
textSize(30);

// make the Color red
fill(255, 0, 0);

// draw text at startX pos for X.
text(“wheee moving text!”, startX, 200);

// make text move
startX = startX + 1;

// end the loop
};

Hope this helped! I really love JavaScript, coding, and helping others so just let me know if you need help!

If you want to contact me directly, you can find me on Khan academy:

(Link im comments)

To send me a message, just click on one of my projects and leave a comment >> just remind me who you are. Happy to help!
User Pxg
by
2.9k points