Sup fellow framers
i've encountered a problem i was hoping yol could help me out. i've got a function that creates a progress bar, now i want to attach this function only to a certain layer. any ideas how i can accomplish this?
I think we'd need to see the function first.
Here it is.
proBar = ->
radius = 90 num = 0
circle = new Layer borderRadius: 100 width: 11 height: 11 backgroundColor: '#00AEEF' x: Screen.width / 2 + radius * Math.cos(num) + (-8.5) y: Screen.height / 2 + radius * Math.sin(num) - 371.5
#BLUE PROGRESS Utils.interval 0, -> if num < Math.PI * 2 num = num + 0.04 circle.x = Screen.width / 2 + radius * Math.cos(num) + (-8.5) circle.y = Screen.height / 2 + radius * Math.sin(num) - 371.5 copy = circle.copy()
#WHITE PROGRESS Utils.interval 0.4, -> if num > Math.PI * 2 if num isnt 12.599999999999907 circle.backgroundColor = "#FFFFFF" circle.width = 11 circle.height = 11 num = num + 0.04 circle.x = Screen.width / 2 + radius * Math.cos(num) + (-8.5) circle.y = Screen.height / 2 + radius * Math.sin(num) - 371.5 copy = circle.copy()
Chris Camargo How do you think i can pull this off buddy?
Marc Krenn any ideas bro?
Tebza Ngwana You’ll have to add an argument to your function: the layer it should be placed in. Like this: http://share.framerjs.com/ybtr01ygczgx/ (I removed all those calculations that use the screen size for positioning, because you’ll have to change them to using the parent layer)
Tebza Ngwana But, actually, you would be better of animating an SVG instead of creating all these overlapping layers…
For a start: check out Josh Puckett’s SVG module: https://www.facebook.com/groups/framerjs/permalink/757715437688863/
Ah, also, by Henrique Gusso: https://medium.com/@gusso/draw-and-animate-an-svg-circle-in-framer-d4bc3a9863c1#.lw7ix4427
Thanks Tes Mat
Check out some of these Pie Charts with SVG
Thanks a lot Jordan Robert Dobson
No problem... I have a lot of work to post up to http://FramerCo.de