02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School

Rotating assets

This is it... we are done with the chapter. This last lecture in the chapter is dedicated to leftovers. By the end of this lesson, we will know how to rotate items in the axis of the curves we created.

Video Transcript

00:00that's it another chapter chapter complete and as this chapter completes i wanted to talk about
00:06a couple remaining items so let's jump right into them and we'll see them it's nothing big
00:11we've been through the horror the horrors of cubic and beziers and quadric and all that fun
00:18stuff i have no idea where that accent was going to but i was just rolling with it all right so
00:22let's get to it let's finish this chapter and the last thing that's left for us to do is to add
00:27a rotation to our animation um and this last thing i'm going to talk about in plug-ins about plugins
00:32in general so we the last two chapters were kind of like their theme was plugins this chapter its
00:38theme was animation in general and more complex animation types and we're going to wrap it up
00:45with something really easy so let's jump into it let's see it in action i'm just going to go to
00:49my bezier curve and i'm going to just into the in the properties of the bezier curve i'm just
00:54going to add here an auto rotate and i could by default just set it to be true and once i do that
01:00once i set it to true it's by default it's false it will automatically because i'm working with the
01:05top and left and there is a rotation property will automatically rotate my property without
01:11me needing to do anything now i'm not happy with the ending position where it's completely upside
01:15down and i want to kind of change its rotation i'm going to have to go into the more advanced
01:20features which is exactly what we're going to do next because it's something you want to know so
01:25instead of setting true you're we're going to send in an array and the first property of the array
01:29is going to be the x position in our case that's left our second property is going to be the y
01:35position in our case that's top and the last one is the rotation property which by the way you
01:40could have rotated also things in the three-dimensional space rotation and the third property
01:48is basically how much of an offset do you want to give your item by default i could set it to no
01:52default which is the traditional default which basically set that for false and it's going to
01:57look for all these properties you have to put them in so zero that means we're not making any
02:01extra rotation false means that we're using degrees and not radians if we wanted to use
02:06radians instead of degrees then we would set that to be true now by doing this nothing
02:10is really going to change visually because we sent in the default parameters as it was
02:15but i can go ahead now and say yeah i want to this is kind of nice but i want to rotate it by
02:19minus 150 degrees more or less so we could see our item straight when it's completed i think
02:24that's around minus 150 i'm just eyeing it here so i'm going to put your 150 and hopefully that
02:30hits the mark and if not we'll go for another pass to try to sort it out and we could see
02:35that it was we definitely overshot here so we probably want to reduce the amount a little
02:40bit more or maybe a little bit less so let's see let's try let me try now 120 and see what does 120
02:47do and i'll go ahead there and just click on save refresh and then we'll see how well so this is
02:54getting worse so i actually had to put a higher value so let me try 180 even so it's a nice
02:59full 180 i don't think it's 180 i think it's probably 170 or 190 but i'm not going to play
03:04around with it further so we have so you play around find how you want it if you're happy
03:09you're done i'm happy for this because it was just the example that we were giving i just wanted to
03:13talk for a second about if you use here radians instead i'm not going to teach you what radians
03:17is really but in general remember that math pi and the math pi we said two math pies is a full
03:26circle so literally if i just divide that by 180 that's going to give me basically one degree
03:31so if i want to take this i could say okay i want to duplicate this by 60 and i'll have
03:35your basically 60 degrees i could go negative i could go positive i'll save this run it and
03:40now our animation should finish with a 60 degree offset but it's really animating all the way
03:44through in a 60 degree offset which coincidentally is sitting really nicely for us so that's it
03:51we're done with this chapter we're done we're done and we'll see you in the next chapter
03:54because this course is not over but we're getting very close

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!