Instantly share code, notes, and snippets.

Embed
What would you like to do?
start = function() {
all my framer code
}
preloadImages = ["a.png", "b.png"];
preloadImagesCount = 0; // How many images were loaded
preloadImages.map(function(image) {
var imageLayer = new Layer({image:image})
imageLayer.on("load", function() {
preloadImagesCount++; // Add one to loaded images
if (preloadImagesCount == preloadImages.length) {
// Run Framer code if all are loaded
start();
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment