Skip to content

Instantly share code, notes, and snippets.

@bre7
Last active February 7, 2018 00:40
Show Gist options
  • Save bre7/30111c57574468f1eb989ac73b01b5a0 to your computer and use it in GitHub Desktop.
Save bre7/30111c57574468f1eb989ac73b01b5a0 to your computer and use it in GitHub Desktop.
Just getting started with Framer & CoffeeScript. This a a loop animation which modifies a layer's opacity
class OpacityLoopAnimation
constructor: (options={}) ->
fadeInAnimation = new Animation({
layer: options.layer,
properties: {
opacity: 1.00
}
time: 1
curve: Bezier.easeIn
})
@mainAnimation = fadeInAnimation
fadeOutAnimation = fadeInAnimation.reverse()
fadeInAnimation.onAnimationEnd ->
fadeOutAnimation.start()
fadeOutAnimation.onAnimationEnd ->
fadeInAnimation.start()
start: ->
@mainAnimation.start()
@bre7
Copy link
Author

bre7 commented Feb 6, 2018

Usage:

anim = new OpacityLoopAnimation({ layer: someLayer })
anim.start()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment