Created
September 1, 2017 15:45
-
-
Save vdel26/f4c5e047574c4512f0ece0903d0c421f to your computer and use it in GitHub Desktop.
Framer / particles background
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
sketch = Framer.Importer.load("imported/medox-framer@2x", scale: 1) | |
stars = sketch.moving_stars.children | |
second_batch = sketch.moving_stars.copy() | |
second_batch.name = 'moving_stars2' | |
second_batch.parent = sketch.BG | |
stars2 = second_batch.children | |
stars.map (s) -> | |
s.y = Screen.height + Utils.randomNumber(0, 200) | |
stars2.map (s) -> | |
s.y = Screen.height + Utils.randomNumber(300, 600) | |
s.x = Utils.randomNumber(5, Screen.width - 5) | |
animate_points = (points) -> | |
points.forEach (s) -> | |
origX = s.x | |
origY = s.y | |
animX = new Animation s, | |
x: origX + Utils.randomNumber(-50, 50) | |
options: | |
curve: Bezier.linear | |
time: 10 | |
delay: Utils.randomNumber(1, 5) | |
animXrev = animX.reverse() | |
animY = new Animation s, | |
y: 0 | |
rotation: 360 | |
options: | |
curve: Bezier.linear | |
time: Utils.randomNumber(50, 100) | |
repeat: 100000 | |
delay: Utils.randomNumber(0, 5) | |
animY.start() | |
animX.on Events.AnimationEnd, animXrev.start | |
animXrev.on Events.AnimationEnd, animX.start | |
animX.start() | |
animate_points(stars) | |
Utils.delay 4, -> | |
animate_points(stars2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment