Last active
June 28, 2018 08:04
-
-
Save typemytype/275609176d112a61cff90ac620fe2ca5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # url to the image | |
| path = 'https://pbs.twimg.com/media/DgwanJqXUAA9847.jpg' | |
| # amount of frames | |
| frames = 30 | |
| # scaling (the image is big) | |
| sc = 0.08 | |
| # get the image size | |
| w, h = imageSize(path) | |
| #start the loop | |
| for i in range(frames): | |
| # calculate the factor and the angle | |
| factor = i / (frames) | |
| a = 360 * factor | |
| # create a new page | |
| newPage(w*sc, h*sc) | |
| # set the scale | |
| scale(sc) | |
| # draw the background | |
| fill(0, 1, 0) | |
| rect(0, 0, w, h) | |
| # translate to the middle | |
| translate(w*.5, h*.5) | |
| # and rotate | |
| rotate(a) | |
| # and translate back | |
| translate(-w*.5, -h*.5) | |
| # draw the image | |
| image(path, (0, 0)) | |
| # save the image on the desktop | |
| saveImage('~/Desktop/giveItaSpin.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment