Same way you would do it in any other language. What would you do to -1 to get 0, to 1 to get 1, and 0 to get 0.5? (Hint: Translate and Scale)