Professional Documents
Culture Documents
April 3
April 3
Project Description:
Parallax is the visual effect whereby the position of an object appears to differ when viewed from different positions. This forms the
basis of a popular effect, used today in animations, games, and in web design. The Parallax effect is constructed using layers of
images. An effect of the viewer position moving is created by moving (and perhaps scaling) the layers of images. Layers that will be
perceived as close to the viewpoint should move fastest, while layers that are far away should move slower, and slower, the further
they recede from the viewpoint.
My goal was to create a parallax effect in my program, using layers of images as the content, and the position of the mouse pointer
as the trigger/input for the change in position.
import Cocoa
import Tin
// the music notes that are symbolic for her singing to the community of San Francisco
let healingMusicX = remap(value: tin.mouseX, start1: 200, stop1: 800, start2:0 , stop2: 20)
pushState()
translate(dx: healingMusicX, dy: 0)
image(image: healingMusic, x: 0, y: 0, width: 1000 , height: 600)
popState()
// Beyonce
let beyonceX = remap(value: tin.mouseX, start1: 300, stop1: 700, start2: 300, stop2: 400)
pushState()
translate(dx: beyonceX, dy: 0)
image(image: beyonce, x: 0, y: 100, width: 500, height: 500)
popState()
let micX = remap(value: tin.mouseX, start1: 100, stop1: 900, start2: 470, stop2: 570)
pushState()
translate(dx: micX, dy: 0)
image(image: mic, x: 0, y: 415, width: 70, height: 100)
popState()
}
}