Presentation is loading. Please wait.

Presentation is loading. Please wait.

Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures.

Similar presentations


Presentation on theme: "Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures."— Presentation transcript:

1 four simple expressions in meta

2 Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures (images) Points (positions within an image) Procedures (programs) Take a set of objects as inputs (arguments) Return another object as a result Procedures are the most important kind of data in computer science

3 Referring expressions in meta Names (‘robin’, ‘rob’, ‘+’, ‘point’) Aka “variables” Refer directly to objects Constants (fixed names) Numbers Refer to fixed objects (the numbers) Strings “Arbitrary text enclosed in double-quotes” Also refer to fixed objects (the text) Functional expressions Sequences of expressions Separated by spaces (or line breaks) Enclosed in square brackets First expression has to refer to a procedure Example: [point 100 100]

4 Some functional expressions [box width height] A picture of a box with the specified width and height (which must be numbers) [ellipse width height] Same, but gives you a curved object instead of a box [line point point] A line with the specified endpoints [point number number] A point with the specified coordinates

5 Rectangles [box width height] Creates a rectangle Centered at (0,0) Width is width Height is height Default coloring Unfilled (interior is left alone) Border drawn in black (which shows up very poorly in these slides) ► [box 200 100] ►

6 hey stupid don’t you think it’s time you did an example?

7 Circles and ellipses [ellipse width height] Same, but curved If width and height are the same, you get a circle Otherwise, an ellipse ► [ellipse 200 100] ► [ellipse 100 100]

8 Lines [line start end] Makes a line from start to end Start and end are point objects Created using [point x y] Note that: Default is black line 1 pixel wide ► [line [point 0 0] [point 100 100]] ►

9 Coordinate system Positions on the screen described by (x, y) coordinates X: number of pixels to the right of the “origin” Y: number of pixels down from the “origin” Coordinates can be negative (system just shifts the image to make them visible) (0,0) (100, 33) (33, 100)

10 Groups [group object object …] Make a composite picture from multiple picture objects Objects can be shapes or other groups ► [group [box 100 100] [box 200 200] [box 300 300] [ellipse 100 100]] ►

11 hey how about another example?

12 Translate [translate point object object …] Shifts objects so that their (0,0) is now at point Shifting by [point 10 20] moves everything Right 10 pixels Down 20 pixels Also acts like a group, so you can include multiple objects and they’re all shifted ► [group [box 200 200] [translate [point 50 0] [box 100 100]]] ►

13 hey show them how to handle errors

14 that’s everything you need to know for the assignment but here’s some other stuff you might have fun with

15 Scaling [scale scale-factor object object …] Make a composite object from multiple picture objects Also acts like a group, so you can include multiple objects and they’re all scaled ► [box 100 100] ► [scale 2 [box 100 100] [box 10 10]] ►

16 Rotate [rotate angle object object …] Rotates contents clockwise angle degrees about the point (0,0) Also acts like a group, so you can include multiple objects and they’re all rotated around (0,0) ► [rotate 45 [box 100 100]] ►

17 Paint [paint color objects …] Fills interiors of objects with color, which can be A color object made with [color red green blue] A string (magic color name) A symbol (magic color name) The word: null (no quotes) Turns off filling Also acts like a group, so you can include multiple objects ► [group [box 200 200] [paint “black” [box 100 100]]] ►

18 Ink [ink pen objects …] [pen color width] Draws the outline of objects with specified pen Pen specifies color and width of line Pen objects can be created with the pen procedure … or you can just specify a color in lieu of a pen Also acts like a group, so you can include multiple objects ► [group [box 200 200] [ink [pen “black” 10] [box 100 100]]] ►

19 Peeking inside the data Objects are like web pages Pages can contain links to other pages Different from containing the pages themselves But I can in some sense pass you a whole set of pages by passing you a link to a single page that has links to the others Forming a group is like making a new web page with links to the component objects You can think of the components as “in” the group Or just as “available to” the group group ellipsebox

20 Data as hierarchy When we group objects inside groups inside other groups We get a tree- structured hierarchy Kind of like outlines And kind of like code group translatebox group translatebox group translatebox note: translate doesn’t actually change its arguments – it makes a translate object

21 Using the Studio Meta is installed on all Studio PCs Log in using your NetID and normal NetID password The Studio will be staffed most nights with people to help you A schedule will be posted shortly You can get a key from the Louis Hall cage (see yesterday’s email)

22 For Wednesday Download programming exercise 1 from the syllabus page: http://www.cs.northwestern.edu/academics/courses/ AnimateArts/AA1 Follow the instructions


Download ppt "Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures."

Similar presentations


Ads by Google