Skip to content

Instantly share code, notes, and snippets.

@wanghailei
Last active July 16, 2024 12:27
Show Gist options
  • Save wanghailei/ad3b609a85dd5f0fd0b2 to your computer and use it in GitHub Desktop.
Save wanghailei/ad3b609a85dd5f0fd0b2 to your computer and use it in GitHub Desktop.
Code snippets of All Seeing Eye
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2009 - 2014, Hailei Wang. All rights reserved.
from nodebox import geo
colors = ximport("colors")
# Define Brush
def composeimage( x, y, colr, radius, points, diminish ) :
nofill()
stroke()
strokewidth( 0.05 )
autoclosepath( False )
count = int( radius * 1.3 )
colr = colors.color( colr )
grad = colors.gradient( colr.darken( 1.0 ), colr, colr.lighten( 1.0 ).desaturate( 0.4 ), steps = count )
for i in range( count ) :
stroke( grad[ i ] )
a = 0.75 - 0.25 * float( i ) / count
colors.shadow( dx = 5, dy = 8, alpha = a, blur = 15 )
path = oval( x - radius + i * 0.5, y - radius + i * 0.5,
radius * 2 - i, radius * 2 - i, draw = False )
drawpath( brushpaint( path, points = int( points - i * 0.2 ), length = radius - i + random( count - i ) / 3, diminish = diminish ) )
# Hold and Draw w/Brush
def brushpaint( path, points = 100, length = 100, diminish = 700 ) :
beginpath( 0, 0 )
for ap in path.points( points ) :
angle = geo.angle( ap.x, ap.y, ap.ctrl1.x, ap.ctrl1.y )
dx,dy = geo.coordinates( ap.x, ap.y, length, angle + 90 )
moveto( ap.x, ap.y )
curveto( ap.x + random( -diminish, diminish ), ap.y + random( -diminish, diminish ), dx + random( -diminish, diminish ), dy + random( -diminish, diminish ), dx, dy )
return endpath( draw = False )
@genidma
Copy link

genidma commented Mar 26, 2018

Hi Hailei,

I'm getting the following error:

File "csallseeingeye.py", line 4, in

from nodebox import geo

ModuleNotFoundError: No module named 'nodebox'

Any suggestions?

Many thanks in advance!

@nazifberat
Copy link

Hi Hailei,

I'm getting the following error:

File "csallseeingeye.py", line 4, in

from nodebox import geo

ModuleNotFoundError: No module named 'nodebox'

Any suggestions?

Many thanks in advance!

Hi Genidma,

As far as I guess that Hailei is writing his code in Nodebox which is only avaliable for Mac users. See-->https://www.nodebox.net/code/index.php/Home

So you should download it and then put that code in it.
Good lucks!

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