Exercise 1.3.1 A) Find out how tock in that figure works manually. Enter expression expressions such as (tock 0) and (tock 1) into DrScheme's Interactions.

Slides:



Advertisements
Similar presentations
First of all – lets look at the windows you are going to use. At the top you have a toolbar, with all your various tools you can use when customising your.
Advertisements

Computer Vocabulary Words to know and remember for the semester.
# 11 COMPLEX SHAPES! MA Determine how measurements such as perimeter and area, of common shapes are affected when one of the attributes is changed.
Create a Simple Game in Scratch
Drawing In One-Point Perspective
Create a Simple Game in Scratch
PHY-102 SAPIntroductory GraphicsSlide 1 Introductory Graphics In this section we will learn how about how to draw graphics on the screen in Java:  Drawing.
CSC 160 Computer Programming for Non-Majors Images: Another Form of Symbolic Data Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #8: Animations I Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #11: Conditionals II Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #3: Calling Functions Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Draft Chapter: The UFO Example Prof. Adam M. Wittenstein
Section 1.1: Flying a UFO (continued). Conversion recipe 1)Expand abbreviations 2)Parenthesize all subexpressions that have an operator. Should end up.
Copyright 2008 by Pearson Education Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2.
Section 1.2: Drawing a UFO (conclusion). Last time… ● Using figure 1, we can now find a UFO’s location (using the X and Y functions). ● And, we can now.
CSC 160 Computer Programming for Non-Majors Section 1.3: Animating the UFOs Flight Prof. Adam M. Wittenstein
Section 1.2: Drawing a UFO (continued). Writing a program to draw UFOs Remember that the header includes: define program’s name(let’s call it UFO-draw)
CSC 160 Computer Programming for Non-Majors Section 1.2: Drawing a UFO Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Chapter 3: Programs are Functions Plus Variable Definitions Prof. Adam M. Wittenstein
Explanation of Web 6, Web 7 and Web 9 at my site Please be sure to bring up the speaker notes for the explanation Intro - Web 6, Web 7 and Web 9.
PROCESSING. * Java SDK * downloads/jdk7-downloads html
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 5 Sept 4th, 2001 Fall Semester.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Click your mouse for next slide Flash – Introduction and Startup Many times on websites you will see animations of various sorts Many of these are created.
Agenda For Feb Finish up Unit 3 Exercises on page Unit 4 Exercises on page 33. Question #2 3. Create a Happy Face Java Applet (due next class).
Computer Graphics Lecture 1 July 11, Computer Graphics What do you think of? The term “computer graphics” is a blanket term used to refer to the.
One-Point Perspective Yevgeny Shnaper. About One-Point Perspective One-point perspective consists of ONE vanishing point on a horizon line. Horizon: a.
Java Programming, Second Edition Chapter Seventeen Multithreading and Animation.
 Supervised by Prof. LYU Rung Tsong Michael Student: Chan Wai Yeung ( ) Lai Tai Shing ( )
Label the points where the graph crosses the x-axis. x y Problem 1.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
Reference: The Game Loop Animation / Game loop 1. Update variables 2. [Get input from the user] (GameLoop only) 3. Draw (using variables)
1 A first OpenGL program Brian Farrimond Robina Hetherington.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Functional Programming Language 1 Scheme Language: part 2.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Teacher Miguel’s. For the month of November our focus was recognition of different shapes and colors. We look around the classroom and find different.
NoufNaief.net 1 TA: Nouf Al-Harbi.
The Circle. Examples (1) – (5) Determine the center and radius of the circle having the given equation. Identify four points of the circle.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Chapter 10 Measurement Section 10.5 Surface Area.
PyGame - Unit 2 PyGame Unit – – Animation.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
L-11 (M-10) Rotational Inertia and Conservation of rotational momentum
Reference: What is it? A multimedia python library – Window Management – Graphics geometric shapes bitmaps (sprites) – Input Mouse Keyboard.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Pixels, Colors and Shapes
Scratch for Interactivity
Adapted from slides by Marty Stepp and Stuart Reges
MOTION.
How is the concept of parallelism seen in the snake game?
Day 4 At A Glance We have one goal for today: 1) Start Graph Boot Camp
Building Java Programs
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
CS 5010 Program Design Paradigms "Bootcamp" Lesson 9.3
Basic Graphics Drawing Shapes 1.
Triangles to Order.
Extra Drawing Practice in Java Script
Building Java Programs
numbers letters colors shapes animals 1pt 1 pt 1 pt 1pt 1 pt 2 pt 2 pt
Directions are in slide notes. You can view them in two ways
Triangles to Order.
Agenda for Unit 5: Control Structures
PowerPoint Lesson 4 Slide Transitions & Custom Animation
Animation Translation.
2D Shapes Rectangle Circle Triangle Rectangle. What shape is the door? Rectangle.
Presentation transcript:

Exercise A) Find out how tock in that figure works manually. Enter expression expressions such as (tock 0) and (tock 1) into DrScheme's Interactions window and see what their results and their effects on the canvas are. Hint: Execute the animation but comment out the expression (on-tick-event tock). B) Make the UFO animation slower and/or faster. C) Render the UFO as a yellow shape. Add an antenna. Make the background blue. D) Swap the two drawing actions in tock. Does this make a difference? Why? Why not?

1.3.1.A: Solution / Explanation Type in some example of tock manually: (tock 0) ;erases the 0 th UFO and draws the 1 st UFO. (tock 1) ;erases the 1 st UFO and draws the 2 nd UFO. In general, tock erases the current UFO and draws the next one. Since we do not want to sit at the computer and keep typing (tock 2), (tock 3), (tock 4), etc., we use a predefined function called on-tick-event. The on-tick-event function takes another function (like tock) and automatically runs it after every clock tick.

1.3.1B,C: Solution / Explanation To slow down the animation, increase the time between clock ticks. For example, (big-bang 1 0). To speed up the animation, decrease the time between clock ticks. For example, (big-bang.3 0). To make the UFO yellow, change the color in the ufo-draw function (from ‘green) to ‘yellow. To make the background blue, we will simply draw a solid blue rectangle the same size as the canvas: (draw-solid-rect ‘blue)

1.3.1C: Solution / Explanation To add an antenna, we add a line (say, 15 pixels long) that extends from the top of the circle. Since the center is (X, Y) and the radius is 10, the top point on the circle is (X, Y – 10). ---In Scheme, that is (X t) and (- (Y t) 10). Since we draw the line 15 pixels up from that point, the line goes up to (X, Y – 25). ---In Scheme, that is (X t) and (- (Y t) 25). So we have, (draw-solid-line0 (X t) (- (Y t) 10) (X t) (- (Y t) 25) ‘yellow)

1.3.1D: Solution / Explanation (define (tock t) (draw (ufo-draw (+ t 1)) (ufo-erase t) produce(+ t 1))) Swapping the 2 drawing actions causes: --part of the antenna may get erased --if the clock ticks are slow enough, you will be able to (incorrectly) have 2 UFOs on the screen at the same time There is no other difference as the 2 actions occur simultaneously, at least to human eyes.

In conclusion… We have written an animation program for moving the UFO across the screen. This program includes several Scheme functions that we wrote, like X, Y, ufo-paint, and tock. It also includes several predefined functions like +, *, draw-solid-rect0, big- bang, and on-tick-event. In HW4, you will write an animation for moving the shots across the screen. Then, you will combine the two animations, and complete the UFO game. For the rest of the semester, we will write shorter programs (each with only one, or a few, Scheme functions).