if (do_name() != 'Home') : ?>
endif ?>
Posted by Tom De Smedt on Sep 25, 2008
Hi Augusto,
What exactly would you like to improve in this script?
Posted by Augusto Carmo on Sep 26, 2008
I don't know if you had the chance to test the code, if you had, you must have realized that when you modify any of the values it changes randomly the number of shapes. I would appreciate if there was a slider that could control the quantity of duplicated objects and. if possible, create one slider that could control the radius and another that could control an angle of the isolate object's rotation, because in the current code the radius and the angle are related with the position of the X and Y axis.
Posted by Tom De Smedt on Sep 27, 2008
include("util/comment.php"); ?>
To control the number of shapes, you can use a slider instead of picking random values from a list. Here's a simplified example:
var("shapes", NUMBER, 10, 3, 100) angulo = 360/shapes + 1 for i in range(int(shapes)): rotate(angulo) rect(distx,disty,tamanho, tamanho, corners)To rotate individual shapes, you'll have to use push() and pop() commands. You can learn more in the graphics state tutorial. Here's another snippet of code:
var("object_angle", NUMBER, 0, 0, 360) for i in range(int(shapes)): transform(CORNER) rotate(angulo) push() transform(CENTER) translate(-distx, -disty) rotate(object_angle) rect(distx,disty,tamanho, tamanho, corners) pop()
how to impruve this:
Posted by Augusto Carmo on Sep 24, 2008size(1000,1000)
try:
colors = ximport("colors")
except ImportError:
colors = ximport("__init__")
reload(colors)
var("H", NUMBER, 0.55, 0.0, 1.0)
var("S", NUMBER, 1.0, 0.0, 1.0)
var("B", NUMBER, 0.6, 0.0, 1.0)
var("opacidade", NUMBER, .5, 0, 1.0)
clr = colors.hsb(H, S, B, opacidade)
fill(clr)
var("tamanho", NUMBER, 25, 10, 500)
var("corners", NUMBER, .5, 0, .65)
var("distx", NUMBER, 0, 1, 500)
var("disty", NUMBER, 0, 1, 500)
c = ['1','2','4','5','6','8','9','10','12','15','18','20','24','30','36','40','45','60','72','90']
v = choice(c)
angulo = 360/int(v)
x = WIDTH/2
y = HEIGHT/2
translate(y,x)
transform(CORNER)
for i in range(int(v)):
rotate(angulo)
rect(distx,disty,tamanho, tamanho, corners)
print v
print tamanho
print distx
print disty
print corners