Programming Optical Illusions

JT
by James Town7 views·Updated Jun 3, 2015
Powered by AI

Need to present on this topic?

Create your own polished presentation in minutes. Just describe what you need.

Free to try, no credit card required

Transcript

Before you Explore

Now it is your turn

Colors are stored as 6 digit ‘numbers’ in RGB (RedGreenBlue) format.

Common colors:

Black ‘#000000’ (no color)

White ‘#ffffff’ (all color)

Grey ‘#cccccc’ (in between)

What do you think yellow would be?

HTML5 Canvas:

View the Example

HTML5 Canvas:

The Origin

Programming Optical Illusions

5. Click on the "See Result >>" button.

But on a typical HTML5 Canvas the origin (0,0) is

As you know, in Cartesian Coordinates the origin (0,0) is

Note: there are no negatives on the basic HTML5 canvas

Caution: though x is the same (right=positive), y is opposite (down=positive)

http://pastebin.com/pPxfEaha

Objectives:

Jim Town

Mathematics Specialist

HTML5 Canvas: View the Example

HTML5 Canvas:

View the Example (overview)

4. Paste the text into the left side of the page (under “Source Code:”).

http://pastebin.com/Z9Ac29iC

tinyurl.com/html5sandbox

  • Design and program your own version of an optical illusion
  • Learn how geometric shapes are represented on the HTML5 canvas
  • Use algebraic thinking to animate the canvas

1. Go to this canvas editor:

2. Delete the code on the left of the page (under “Source Code:”).

3. Copy all of the text in the template.

4. Paste the text into the left side of the page (under “Source Code:”).

5. Click on the see result button.

pastebin.com/ai7AcPMj

Now it is your turn

HTML5 Canvas Animation:

Before you Explore

http://pastebin.com/QiNE1BdK

HTML5 Canvas:

View the Example

HTML5 Template:

View the Example

http://pastebin.com/ai7AcPMj

1. Go to this canvas editor.

http://tinyurl.com/html5sandbox

HTML5 Canvas:

View the Example

Time to Reflect

2. Delete the code on the left of the page (under “Source Code:”).

3. Copy all of the text in the template (ctrl-a, ctrl-c if you are in windows).

1. How were you ‘doing’ math?

2. Where would this unit fit into your

curriculum?

3. How would students benefit from this

type of lesson?

Did we meet the objectives?

  • Design and program your own version of an optical illusion
  • Learn how geometric shapes are represented on the HTML5 canvas
  • Use algebraic thinking to animate the canvas

Resources? w3schools.com missblomeyer.com

This prezi:

tinyurl.com/html5prezi2015

To keep in mind...

Animation Example

tinyurl.com/html5sandbox

Thank you for your participation!

Jim Town

jtown@acoe.org

@town_math

All of the illusions can be drawn with the shapes in the basic example (straight lines and rectangles).

Figure out how many lines and rectangles you need and where you think they should be. It might help to draw it on paper first.

In programming it is usually best to make little changes and then test, instead of writing everything and not knowing where the problem is when it doesn't work. Think baby steps.

1. Open a new editor window:

2. Delete the code on the left of the page (under “Source Code:”).

3. Copy all of the text in the template.

4. Paste the text into the left side of the page (under “Source Code:”).

5. Click on the submit code button.

pastebin.com/p7FBNFW5