Download presentation
Presentation is loading. Please wait.
Published byKory Butler Modified over 9 years ago
1
Functions and Visual Effects Chapter 6 Part 3
2
Built-in Functions We have been using built-in functions so far 2
3
How a Function Works A function o Receives value(s) as arguments in parameters o Performs computations on the value(s) o Returns (sends back) a value 3
4
Types of Functions The function type depends on the type of value it returns Examples o Number o Specific object o Boolean (true or false) o Color o Other property values… 4
5
Create Function Click on create new function in class or world you want it to be in Name function and choose type of function A blank function will be created with return statement Value will be returned when function is done o Place value you want returned in return statement 5
6
Function Window Since no action is performed in a function all instructions will be performed in sequential order o No need for Do in order and Do together o All will be Do in order Notice that you can place return elsewhere in function 6
7
Calorie Example A high school jock wants to know how many calories a cookie has He asks a lunch lady She consults the newly created calorie function o 1 meter wide cookie = 1000 calories Number Function calories Parameter: food Local Number variable: numCalories If food = cookie numCalories = cookie’s width *1000 Return numCalories 7
8
Algorithm Translated to Alice My first method has jock ask lunch lady for the calories in the cookie The lunch lady checks how many calories with the calorie function and answers with the amount of calories 8
9
Visual Effects and Animation Billboards Fog Vehicles Pose Programming the Camera Creating Dummy Objects 9
10
Billboards Graphical images that have been inserted into the world Can insert images that are JPEG, GIF, TIF Known as “Billboard” Images are flat, 2D with height and width no depth Can be used as backgrounds or scenery or used to give info to the viewer! Boy are you shallow, you’re only 2D! 10
11
Information Billboard Can be used as sign for instructions 11
12
Creating Billboard Can import images using Make Billboard In File menu 12
13
Fog Alice can give a look of “mist” to the world The entire world becomes less visible 5-13
14
Vehicle Property To have two objects move as one One object will be carried by another object o Ex: person on horse Horse is vehicle for person Choose properties tab o In property of object being carried In vehicle choose object doing carrying 14
15
Pose Once an object has been put into a position or pose, the pose can be restored during an animation o Pose is a property of an object o setPose is a method of an object 15
16
Programming the Camera Camera can be programmed just like other objects All the same primitive methods and functions are available for it: o Point at, Move, Turn, etc. Camera can also be a vehicle for other objects 16
17
Creating Dummy Objects Dummy objects are invisible objects that are placed in the world Camera then moves to the invisible object to get different perspectives 17
18
Homework Read chapter 6 sections 6, 8, 9 Do tutorial 6 and 7 Do lab exercises Answer questions in handout Due one week after assigned with 1 week grace 18
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.