0:00:01.336,0:00:04.608 So now that we learned how to use text,[br]let's get a bit more fancy. 0:00:04.608,0:00:06.008 The first fancy thing is that now we're 0:00:06.008,0:00:08.278 going to start using the word "string". 0:00:08.278,0:00:10.610 You might think, "String?[br]That's what my cat plays with." 0:00:10.610,0:00:12.725 But for programmers,[br]string is a special name 0:00:12.725,0:00:14.580 we use for bits of text. 0:00:14.580,0:00:16.566 You can think of it like[br]a string of characters, if it helps. 0:00:16.566,0:00:19.073 Your name is a string,[br]your school's name is a string, 0:00:19.073,0:00:22.100 and every text message[br]you've ever sent is also a string. 0:00:22.100,0:00:25.498 Basically, just think, string equals text. 0:00:25.978,0:00:28.565 So we used drawing[br]and coloring with strings already. 0:00:28.565,0:00:30.987 Could we use variables[br]with strings? Of course! 0:00:30.987,0:00:33.225 Just like you might normally[br]put a number into a variable, 0:00:33.225,0:00:35.233 you could also put a string[br]into a variable. 0:00:35.453,0:00:37.391 We just say something like, 0:00:37.391,0:00:40.965 "var myName = (whatever your name is)"[br]so "Sophia"; 0:00:40.965,0:00:42.599 remembering those quotes. 0:00:42.599,0:00:44.484 And then we put the variable myName 0:00:44.484,0:00:46.799 into the quoted text[br]instead of writing "Sophia" directly, 0:00:46.799,0:00:48.536 like we were doing before. 0:00:48.536,0:00:50.528 And this way though it[br]looks the same right now, 0:00:50.528,0:00:53.300 we can actually,[br]write this multiple times 0:00:53.300,0:00:55.333 you know, one time there, one time there, 0:00:55.333,0:00:57.316 you know maybe we[br]can be a little artistical. 0:00:57.316,0:00:59.402 And then all you have to do[br]is to change this one variable 0:00:59.402,0:01:02.008 to be your name, and then you have 0:01:02.008,0:01:04.025 your name written three times. 0:01:04.025,0:01:07.233 So, just flipping that back,[br]what if we want to get 0:01:07.233,0:01:09.541 kind of crazy, can we[br]start adding together strings? 0:01:09.541,0:01:12.819 Like you remember when we maybe[br]started adding together variables? 0:01:12.819,0:01:14.581 Well we can actually do that, 0:01:14.581,0:01:17.063 the computer will just[br]stick the two strings together. 0:01:17.063,0:01:19.547 So for example, you know,[br]we can get rid of this, 0:01:19.547,0:01:22.248 to do it only one time[br]and then we can use this other variable 0:01:22.248,0:01:27.080 message that's going to be my name,[br]plus say a bunch of exclamation marks. 0:01:27.750,0:01:30.305 And if we stick message into text[br]to draw this variable 0:01:30.305,0:01:32.830 instead of my name,[br]we can see that 0:01:32.830,0:01:34.641 all it did is just stuck those exclamation marks 0:01:34.641,0:01:37.312 that we had onto the back of my name. 0:01:38.062,0:01:40.172 And we can even make this[br]a little bit more exciting, 0:01:40.172,0:01:42.962 if we wanted to write message, say, twice. 0:01:42.962,0:01:46.068 So this looks pretty reasonable,[br]you know adding strings means 0:01:46.068,0:01:49.034 you stick one string[br]onto the back of the other string. 0:01:49.034,0:01:51.627 But you might be thinking,[br]can we get really crazy? 0:01:51.627,0:01:54.550 And start multiplying or dividing[br]or subtracting strings? 0:01:54.550,0:01:57.348 Could we do that? Well no we can't, 0:01:57.348,0:01:59.326 with strings we can only add them. 0:01:59.326,0:02:01.754 You're right that we could divide[br]and subtract with number variables, 0:02:01.754,0:02:04.662 but string variables only allow us to add. 0:02:04.662,0:02:07.444 But still being curious and asking[br]those sorts of questions, 0:02:07.444,0:02:09.526 is the right attitude in programming. 0:02:09.526,0:02:11.859 You might think, "What would[br]it mean to divide a string?" 0:02:13.134,0:02:16.930 So we can also use animation[br]and mouse interaction with text strings. 0:02:17.500,0:02:20.291 For example, we can make the string[br]follow the mouse around. 0:02:20.291,0:02:23.186 Just by sticking it in a draw loop[br]like we did with the rectangles. 0:02:23.476,0:02:26.425 So if you think about how to do this,[br]we would say var draw, 0:02:26.795,0:02:29.664 and then we'll stick all of this, right in here. 0:02:29.664,0:02:32.905 This probably looks really familiar,[br]from "intro to animation." 0:02:32.905,0:02:36.332 And you might think, alright, well to[br]make it follow the mouse around, 0:02:36.332,0:02:39.459 we certainly need to use[br]mouseX, and mouseY 0:02:39.459,0:02:43.188 and there you have it we're[br]actually painting with our name. 0:02:43.188,0:02:46.823 And of course if we wanted,[br]we could easily set a background, 0:02:46.823,0:02:50.828 say to, you know, a nice light blue. 0:02:50.828,0:02:55.082 And now we have that the text[br]is just following the mouse around, 0:02:55.082,0:02:56.796 just like we saw with the rectangles. 0:02:57.186,0:03:00.133 And now as a last fun trick,[br]let's use animation, 0:03:00.133,0:03:02.640 and make the text size[br]grow and grow and grow. 0:03:02.640,0:03:06.229 So, here we're setting the textSize to 30,[br]as we learned in variables 0:03:06.229,0:03:10.794 instead of using 30, we could also say,[br]var howBig equals 30; 0:03:10.794,0:03:14.199 and then use this variable[br]instead of doing 30 directly. 0:03:14.649,0:03:16.417 Well that's the exact same thing, 0:03:16.417,0:03:18.646 and we need to obviously[br]be changing something 0:03:18.646,0:03:20.485 in order to get an animation. 0:03:20.485,0:03:25.424 So we can do that by saying,[br]how big equals how big plus one 0:03:25.424,0:03:28.314 which actually means,[br]if you remember howBig gets, 0:03:28.314,0:03:32.214 you know how big it was before,[br]plus one to make it a little bit larger 0:03:32.214,0:03:34.754 and now we just need to[br]restart the program, 0:03:34.754,0:03:37.495 and here we have that[br]as we're moving the mouse around, 0:03:37.495,0:03:39.856 the text size is growing and growing[br]and growing and growing 0:03:39.856,0:03:41.939 because of this line right here. 0:03:43.262,0:03:44.716 And you know, just on your own, 0:03:44.716,0:03:47.590 you might think, okay how[br]can we make it grow faster? 0:03:48.086,0:03:51.653 So now, not only do you know how[br]to manipulate shapes with code, 0:03:51.653,0:03:54.771 but you can also use text with code as well.