ANIMATED VERSION NOTES Requirements: Creates illusion of fluid motion Animation is meaningful (not frivolous) Animation parameters/variables are meaningfully named Control structures are used to enable animation Sketch uses linear transf. fxns to create interaction/animation Identify key-frames and use tweening to connect them. Use a form of randomness to make the output more interesting without losing meaning. Style the output according to a set of established aesthetic practices. The output and the code have clear meaning to a first-time user. The output and the code inspire awe, wonder, and/or action. ------------------------------------------------------------------------------------------- INTERACTIVE VERSION NOTES (scroll down for the animated version notes) Create a scene controller variable to track which scene we're drawing Create an event listener for: LEFT CLICK RIGHT ARROW KEY INITIAL PRESS To increment the scene controller, modulo the total number of scenes Create an event listener for: LEFT ARROW KEY INITIAL PRESS To decrement the scene controller, modulo the total number of scenes --Coding problem with tracking initial presses: You will need to implement a monostable circuit (cf. the madlib ex.). Put a bunch of the repeated stuff into functions so it's easier to keep a hold of: DRAW AXES DRAW DATASET 1, DATASET 2 DRAW REGRESSION 1, REGRESSION 2, COMBINED REGRESSION WRITE TEXT INTO BOTTOM OF CANVAS Plop each scene into a function that dictates what to draw SCENE #0: Blank plot Text that gives name of phenomenon, explains user controls (click, arrow keys) SCENE #1: Set-up text You are tracking two variables: some independent variable x that influences the dependent variable y Say, as an example, we're looking at basketball players around the same age We let x = inches above 5 ft. and y = no. of free throws made out of 10 SCENE #2: You have two datasets: circles and squares These form two parts of the same population Draw circles and squares on the plot, in the centre SCENE #3: Suppose the circles make a positive correlation SUPPRESS AXES The more x increases, the same thing follows for y Draw circles in a line with a regression SCENE #4: Also suppose the same is true for the squares SUPPRESS AXES Draw squares in a line with a regression SCENE #5: What do you think will happen if we plot both datasets at once? DRAW AXES Draw question marks on plot SCENE #6: Did you think there would still be a positive correlation? In this case, there isn't! The combined datasets have a negative correlation. Draw both datasets with the combined regression SCENE #7: Of course, if the two datasets happened to be positioned differently, there could still be a positive correlation. Draw moved datasets with positive combined regression SCENE #8: But you can't tell which way the combined trend will go just by looking at the datasets invidually. Bring back the drawing from scene no. 6 SCENE #9: Sometimes when multiple groups of data have the same trend, combining the data causes the trend to reverse. This phenomenon is called {Simpson's paradox}{bold}. Draw scene no. 6 plus individual regressions SCENE #10: When this occurs, there isn't a simple, direct correlation between your independent and dependent variables. Confounding variables may be at play. So in our example, maybe the basketball players had different coaching quality. Click the diagram or press the right arrow key to restart. Keep same drawing from scene no. 10