Created
October 8, 2015 22:57
-
-
Save arronhunt/8e7b3342e30fcf51dc92 to your computer and use it in GitHub Desktop.
Confetti module for FramerJS
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
colors = ["#f23f3f", "#ff7f3b", "#f2c83f", "#3ac95c", "#4a95ff", "#ac59ff", "#ff8aed", "#3bbdca"] | |
fetti_bag = [] | |
exports.kaboom = () -> | |
unless fetti_bag.length > 1 | |
for i in [0..100] | |
fetti = new Layer | |
width: 20, height: 20 | |
scale: Utils.randomNumber(0.75, 1.25) | |
backgroundColor: Utils.randomChoice(colors) | |
x: (Screen.width/100)*i, y: Utils.randomNumber(-600, 0) | |
rotationX: 0 | |
rotationY: 0 | |
rotationZ: 0 | |
fetti.animate | |
properties: | |
rotationY: 360 | |
rotationX: 360 | |
rotationZ: 360 | |
time: Utils.randomNumber(.25, 1.25) | |
repeat: 9999 | |
curve: "linear" | |
fetti.animate | |
properties: | |
y: screen.height + 600 + fetti.y | |
x: Utils.randomNumber(fetti.x-600, fetti.x+600) | |
time: 5 | |
curve: "linear" | |
fetti.animate | |
properties: | |
opacity: 0 | |
delay: 4.5 | |
time: 0.5 | |
fetti_bag.push(fetti) | |
Utils.delay 6, -> | |
for f in fetti_bag | |
f.destroy() | |
f = null | |
fetti_bag = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment