This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Aditya Narayan
Posted Aug 19 - Read on Facebook

Hey everyone, I am trying to create a "listening" animation. I used for loop to create a series of lines and animate them infinitely. But only the last line is animating.

I am attaching the prototype. I would appreciate some help with this.

1 Comments

Derek Nguyen

In your for loop, wrap all the code inside a `do` command, like
```
for child in lines.subLayers
--do (child) ->
```

"When using a JavaScript loop to generate functions, it’s common to insert a closure wrapper in order to ensure that loop variables are closed over, and all the generated functions don’t just share the final values. CoffeeScript provides the do keyword, which immediately invokes a passed function, forwarding any arguments."
http://coffeescript.org/

Read the entire post on Facebook