Radial animation
-
Hi everyone, I’m looking for a way to create a radial animation, I’m trying it with the following code:
thickness = 10 isOval = True limit = height() isBlack = True jumpinValue = 0 while jumpinValue < limit*1.3: fill(None) strokeWidth(thickness) if isBlack is True: stroke(0) else: stroke(1) if isOval is True: oval((width()/2)-(jumpinValue/2), (height()/2)-(jumpinValue/2), jumpinValue, jumpinValue) else: rect((width()/2)-(jumpinValue/2), (height()/2)-(jumpinValue/2), jumpinValue, jumpinValue) newPage(1000, 1000) isBlack = not isBlack jumpinValue += thickness
What I want to make is to keep the circles while new circles appear and then make the radial animation.
Thanks for your help.
-
hello @eduairet,
What I want to make is to keep the circles while new circles appear and then make the radial animation.
you could draw the shape using a function which takes the number of steps as a parameter; at every new page, you increase the number.
have a look at this example. good luck!
-
@gferreira it worked, thanks a lot, I want to know if there’s a way to control the speed of the animation?.
def drawShape(step): jumpinValue = 0 thickness = 3 fill(None) strokeWidth(thickness) stroke(0) fill(None) translate(0, 0) for i in range(step): oval((width()/2) - (jumpinValue*3), (height()/2)-(jumpinValue*3), 10+(jumpinValue*4), 10+(jumpinValue*4)) translate(thickness, thickness) jumpinValue += thickness # create pages/frames for i in range(150): newPage(1000, 1000) fill(1) rect(0, 0, 1000, 1000) drawShape(i+1) # save animation saveImage('~/Desktop/radial.mp4')
-
hello @eduairet,
I want to know if there’s a way to control the speed of the animation?
yes, you can set the duration of each frame in seconds – see frameDuration
-
@gferreira wow, this is huge!!! thank you again