Skip to content

Instantly share code, notes, and snippets.

@wanghailei
Created June 6, 2014 03:51
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save wanghailei/a95ceaa8c662e33cf3e3 to your computer and use it in GitHub Desktop.
Save wanghailei/a95ceaa8c662e33cf3e3 to your computer and use it in GitHub Desktop.
Code snippets of BB IDEO LABS
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2010 - 2014, Hailei Wang. All rights reserved.
colors = ximport( "colors" )
font( "Courier", 200 )
align( CENTER )
text_path_line_1 = textpath( "IDEO", 0, 200, width = WIDTH)
text_path_line_2 = textpath( "LABS", 0, 350, width = WIDTH)
resx = 200
resy = 80
rx = 2.0
ry = 1.5
dotsize = 5.5
dx = WIDTH  / float( resx )
dy = HEIGHT / float( resy )
def draw_text() :
nofill()
strokewidth( random( 0.2, 2.8 ) )
clr = choice( [ colors.hex( "#FF0000" ), colors.hex( "#FF0033" ), colors.hex( "#000000" ), colors.hex( "#FF0011" ), colors.hex( "#000000" ) ] )
clr.a = random( 0.6, 1 )
stroke( clr )
oval( pointx + random( -rx, rx ), pointy + random( -ry, ry ), size, size )
for x, y in grid( resx, resy ) :
size = choice( [ 1, 2, 2, 2, 3, 3, 3, dotsize ] )
pointx = x * dx - size
pointy = y * dy - size
if text_path_line_1.contains( pointx, pointy ) or text_path_line_2.contains( pointx, pointy ) :
draw_text()
@daniloleite
Copy link

Hi Hailei,
How are you?

I am learning about python arts possibilities ... I don't have a good knowledge about programing languages, but I liked the python.
This code can Run in a IDE like PyCharm? Can you advise an interesting IDE for a beginner?

Do you know How Can I import vector images (ai or eps, svg) and mix that in a different dimensions, positions and rotations (aleatory)?

Thank you!!!

Danilo

@NullBhikkhu
Copy link

@daniloleite

Hi.

I am not Hailei, but I am a random person who is also learning python. If you want my two cents, here's my input:

While not an IDE, my favorite text editor (which can act as an IDE if you want it to) is Atom. It's fully customizable. You can make it look and behave any way you want, but if you don't want to bother with all of that, it comes out of the box usable and beautiful.

As for you vector images question, I have no experience in this area. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment