Created
January 21, 2013 21:34
-
-
Save erhard/4589644 to your computer and use it in GitHub Desktop.
loading multiple images with coffeescript and KineticJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0 | |
height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0 | |
x_pos = 0 | |
y_pos = 0 | |
window.onload = -> | |
list_of_photos = jQuery('#_image img') | |
stage = new Kinetic.Stage | |
container: "gallery_container" | |
width: width | |
height: height | |
images_layer = new Kinetic.Layer() | |
for image in list_of_photos | |
fig = figure (image.src) | |
images_layer.add fig | |
stage.add images_layer | |
figure = (link) -> | |
imageObj = new Image() | |
imageObj.src = link | |
x_pos = x_pos + 100 | |
y_pos = y_pos + 100 | |
bild = new Kinetic.Image | |
x: x_pos | |
y: y_pos | |
image: imageObj | |
draggable: true | |
width: 200 | |
height: 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment