COMPSCI 1JC3 Lecture Notes - Lecture 8: Special Functions, Init
Document Summary
Comp sci sep 22 2016 lecture. Two pieces of state: starts out yellow but it can be red or blue. Three parts of an app: state (mode, view -function that shows people what"s going on, update changes all the time, code main = init. Init refers to the initial state of the app. Without the update, it"s just a static picture. Can also scale things (use scale function: it scales a shape by a specific factor. Can rotate things, use rotate function: code thing model |> move model. pos|> scale 2 rotate (pi/4, can also do it in degrees not just radians, code thing model |> move model. pos|> scale 2 rotate (degrees 60) The movement has to be shown in both x and y for it to move both horizontally and vertically. To add a third button, you don"t have to change a state. To add a third button, you have to change the view: code.