Start
Growing circles
Click event
Class in RapydScript
Stop
""" This example is a porting to RapydScript of 'Growing circles' published on http://jcscript.com/ See how easy it is to use Javscript libraries, here "jCanvaScript" And if you don't know how to translate to RapydScript just use inline Javascript. More info on RapydScript : http://pyjeon.pythonanywhere.com/rapydscript For now the code can not be saved. You can contact me to gmail.com using salvatore.didio, if you would like me to enhanced this site. Just press 'Start' to start the demo. Please, be patient while compiling You can modify the code and press 'Start' to update the demo. """ """ def changeColor(): return JS("function(){this.color('#00ff00')}") jc.start('can',True) jc.circle(100,120,50,'#ff0000',1).id('myCircle_2').click(changeColor()) """ random = Math.random floor = Math.floor def startShow(): r = floor(random() * (254)) g = floor(random() * (254)) b = floor(random() * (254)) x = floor(random() * (600)) y = floor(random() * (600)) die = floor(random() * (3000)) + 1 color = "rgba("+r+", "+g+", "+b+", 0.5)" filled = 1 radius = floor(random() * 8) jc.circle(x, y, radius, color, filled) \ .animate({radius:200,opacity:0}, die, JS('function(){this.del();}')) #http://stackoverflow.com/users/5261/seandowney def clear(): jc.clear('can') highestTimer = setTimeout(";") for i in range(highestTimer): clearTimeout(i) def start(): clear() setInterval(startShow, 50) jc.start('can',True) start()