25
Locally Edited Animations • We will need 3 files to help get us started at http://www.scottbunin.com/27.zi p .

Locally Edited Animations

  • Upload
    chesna

  • View
    24

  • Download
    0

Embed Size (px)

DESCRIPTION

Locally Edited Animations. We will need 3 files to help get us started at http://www.scottbunin.com/27.zip . . Files Explained. We will need 3 files that all do important things for this project: 1. 27.htm is the page that the end user will load to see what we made - PowerPoint PPT Presentation

Citation preview

Page 1: Locally Edited Animations

Locally Edited Animations

• We will need 3 files to help get us started at http://www.scottbunin.com/27.zip.

Page 2: Locally Edited Animations

Files Explained

• We will need 3 files that all do important things for this project:

• 1. 27.htm is the page that the end user will load to see what we made

• 2. init.js is a settings file that sets up so the scripts work

• 3. processing.js is a file that lets us run our scripts in an easy way like we did at the Khan web site

Page 3: Locally Edited Animations

HTML Code to Include Scripts<html> <head> <title>A Processing.js Example</title> <script type="text/javascript" src="processing.js"></script> <script type="text/javascript" src="init.js"></script> </head> <body><script type="application/processing">size(600, 400); // Size should be the first statementframeRate(30); //this adjusts program's speed//put rest of program after this

</script><canvas></canvas><!-- END OF THE FIRST CANVAS --> </body></html>

Page 4: Locally Edited Animations

SCRIPT 1, 20% Go to the Khan Web Site and develop

your Crazy Painter Program. You may work off of spinoff examples, however, you must make your own changes.

Write a paragraph about which spinoff you selected and what changes you decided to implement to your version.

Add some more examples from our previous project so that they can show up on your web site.

Page 5: Locally Edited Animations

ReviewLocally Edited AnimationsFiles ExplainedHTML Code to Include ScriptsScript 1, 20%

Page 6: Locally Edited Animations

Old Fashioned BrowsersSome times a computer is running a browser

that is not up to date with the latest and greatest abilities. For example, Google Chrome may be installed on a machine with a recent version. Internet Explorer may have an outdated version. There are two solutions to this. You can update the browser to the latest version. You can run the web page in a different browser. To run the web page in a different browser, instead of left clicking on it, right click and choose to run it in the more recent browser version.

Page 7: Locally Edited Animations

KHAN WEBSITE FUNCTIONS Even though the Khan web site uses a

similar setup, there are still some important differences. On the Khan website, a student would write:

var draw = function(){

Instead of writing it like that, set the line of code likes this:

void draw(){

Page 8: Locally Edited Animations

Public TransportationTry the project at the link:https://www.khanacademy.org/cs/programmin

g/animation-basics/p/project-public-transportation

You can design a vehicle and design a background.

Be sure to look at some of the examples of other student’s work in the spinoff section.

Page 9: Locally Edited Animations

SCRIPT 2, 20% Create your own Transportation project

and add it to your 27.htm document.

Write a paragraph describing what you have done.

Page 10: Locally Edited Animations

ReviewOld Fashioned BrowsersKhan Website FunctionsPublic TransportationScript 2, 20%

Page 11: Locally Edited Animations

USING CONDITIONAL STATEMENTS By using this link below: https://www.khanacademy.org/cs/progra

mming/logic-if-statements/p/challenge-bouncy-ball

a student can practice making their animations a little smarter.

The shapes should not go off the screen.

We will help this with conditional statements.

Page 12: Locally Edited Animations

The End of the (game) WorldThe canvas has a certain size. In the Khan

cloud service, it is 400. In our local example it is 600. By putting I an if statement, we can check to see if the object is too far along to continue. Then we can change its direction. For example, if a shape was moving to the right, we could check to see if it was hitting the edge at 400.

If (x > 400) {speed = -5;}

Page 13: Locally Edited Animations

var x = 20; // position of the ballvar speed = 5; // how far the ball moves every timevar draw = function() { background(202, 255, 97); fill(66, 66, 66); ellipse(x, 200, 50, 50); if (x > 400) { speed = -5; } if (x < 0) { speed = 5; }x = x + speed; // move the ball};

Page 14: Locally Edited Animations

Script 3 20%Add a script to your 27.htm so that an

interesting looking game object can bounce off the walls.

Write a paragraph about what you have done and include it in an aesthetically pleasing format on your 27.htm web page.

Page 15: Locally Edited Animations

REVIEW Using Conditional Statements The End of the (game) World Code Example Script 3 20%

Page 16: Locally Edited Animations

MOUSE INTERACTION WITH PROGRAM Check out the program at: https://www.khanacademy.org/cs/progra

mming/logic-if-statements/p/more-mouse-interaction

This function will show us an example of how to make things happen in a program when a user gives input from the mouse. Any good program or game should respond or else it is just functioning like a video.

Page 17: Locally Edited Animations

position = position + speed;ellipse(position, mouseY, 50, 50); if (mousePressed) { ellipse(mouseX, position, 50, 50); }if (position > 375) { speed = -5; } if (position < 25) { speed = 5;

Page 18: Locally Edited Animations

DIFFERING FUNCTION NAMES Some of the functions that the Khan

web site uses work well on the Khan web site but not in regular browsers. On the Khan website the function mouseIsPressed works very well. When using it in a regular .htm file such as or project for 27.htm, call the function as mousePressed without the “is”.

mouseIsPressed(); mousePressesd();

Page 19: Locally Edited Animations

Script 4, 20%Create an improved version of the program

example of two balls that are changed by mouse movements on the Khan web site called “challenge-bouncy-ball”. Be sure to have different colors and shapes.

Use the mousePressed function to create an improved version of your Crazy Mouse program.

There are two scripts and no paragraphs assigned.

Page 20: Locally Edited Animations

REVIEW Mouse Interaction With Program Code Example Differing Function Names Script 4, 20%

Page 21: Locally Edited Animations

RUBRIC PART 1 Personalized Crazy Painter Program to

local file. Paragraph on how you made your Crazy

painter. Personalized Transportation project to

local file. Paragraph on how you made your

Transportation Project Personalized bouncing object added to

local file.

Page 22: Locally Edited Animations

RUBRIC PART 2 Paragraph on bouncing object. Personalized improved version of

bouncy ball on local file. Personalized improved Crazy Painter

program using the mousePressed() function to draw.

Aesthetics of Canvases. Aesthetics of text.

Page 23: Locally Edited Animations

DECIDING YOUR CANVAS SIZE

It says size(600, 400); in the example, but we may want to change that. Make the script the size you want it to be. The 600 can determine width so make it better to get a wider script. The 400 decides the height so make it bigger to get a taller canvas. You can even make it take up the whole screen with: size(screen.width, screen.height);

Page 24: Locally Edited Animations

AESTHETICS AND FUNCTION Most of the rubric has focus on making the

project have functional scripts and paragraphs. For the two parts of the rubric that focus on aesthetics, try some of the following suggestions:

Font size/color/face. <h1> tag Canvas sizes Background color Centering Pictures Links

Page 25: Locally Edited Animations

REVIEW Rubric Part 1 Rubric Part 2 Borrowing Something Awesome Aesthetics and Function