diff --git a/innernaut.py b/innernaut.py index c5f4fa9..92e003e 100644 --- a/innernaut.py +++ b/innernaut.py @@ -5,6 +5,7 @@ from flight.server import FlightServer server = FlightServer.ensure_threaded_instance() + #%% @@ -37,14 +38,16 @@ def RoundedRect(x, y, width, height, radius): client.activate() MaskRadius = 500 -EyeSeparation = 175 +EyeSeparation = 200 EyeXRadius = 120 -EyeYRadius = 150 +EyeYRadius = 160 PupilHeight = 30 PupilWidth = 150 +EyelidWidth = 60 +EyelidHeight = 40 EyeOutsideThickness = 50 NoseHeight = 250 -NoseWidth = 130 +NoseWidth = 120 NoseUpturn = 25 MouthOffset = 280 MouthWidth = 180 @@ -52,18 +55,19 @@ MouthHeight = 120 MouthCornerRadius = 30 LipThickness = 50 TriangleCount = 30 -TriangleHeight = 30 +TriangleHeight = 40 TriangleSeparation = 20 OuterTriangleRadius = 450 InnerTriangleRadius = 430 -with Screen('main', width=1920, height=1080) as screen: - with Pattern('beads', width=30, height=30) as beads: +with Screen('main', width=1080, height=1080) as screen: + with Pattern('beads', width=40, height=40) as beads: for x in range(3): for y in range(3): - with Path(tags='odd' if (x + y) % 2 == 1 else 'even', - color='red' if (x + y) % 2 == 1 else 'blue', - x=x * beads.width / 2, y=y * beads.height / 2): + odd = (x + y) % 2 == 1 + with Path(tags='odd' if odd else 'even', + color='magenta' if odd else 'cyan', + x=x * beads.width / 2, y=(y + (x % 2) / 3) * beads.height / 2): Ellipse(0, 0, beads.width / 5, beads.height / 5) FillPath() with Group('mask', x=screen.width/2, y=screen.height/2): @@ -71,18 +75,28 @@ with Screen('main', width=1920, height=1080) as screen: with Path(tags='outer', color='#330'): Ellipse(x=0, y=0, radiusX=MaskRadius, radiusY=MaskRadius) FillPath() - with Path(tags='inner', pattern='beads'): + with Path(tags='inner', pattern='beads', fader=0.25): Ellipse(x=0, y=0, radiusX=InnerTriangleRadius, radiusY=InnerTriangleRadius) FillPath() with Group('eyes'): for side, multiplier in [('left', -1), ('right', 1)]: - with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeRadius)): - with Path(tags='inside', color='#330'): + with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeXRadius)): + with Path(tags='inside', color='#220'): Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius) FillPath() with Path(tags='pupil', color='white'): Rect(-PupilWidth / 2, -PupilHeight / 2, PupilWidth, PupilHeight) FillPath() + with Path(tags='eyelid upper', color='#fc3', y=-EyeYRadius / 2): + MoveTo(0, -EyelidHeight / 2) + LineTo(-EyelidWidth / 2, EyelidHeight / 2) + LineTo(EyelidWidth / 2, EyelidHeight / 2) + FillPath() + with Path(tags='eyelid lower', color='#fc3', y=EyeYRadius / 2): + MoveTo(0, EyelidHeight / 2) + LineTo(-EyelidWidth / 2, -EyelidHeight / 2) + LineTo(EyelidWidth / 2, -EyelidHeight / 2) + FillPath() with Path(tags='outside', lineWidth=EyeOutsideThickness, color='#072'): Ellipse(x=0, y=0, radiusX=EyeXRadius + EyeOutsideThickness/2, radiusY=EyeYRadius + EyeOutsideThickness / 2) StrokePath() @@ -102,29 +116,41 @@ with Screen('main', width=1920, height=1080) as screen: with Path(tags='inside', color='white'): RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius) FillPath() - with Path(tags='outside', color='#330', lineWidth=LipThickness): + with Path(tags='outside', color='#220', lineWidth=LipThickness): RoundedRect(-(MouthWidth + LipThickness) / 2, -(MouthHeight + LipThickness) / 2, MouthWidth + LipThickness, MouthHeight + LipThickness, MouthCornerRadius + LipThickness) StrokePath() with Group('triangles', color='#fc3'): - with Group('outer'): + with Group('outer_triangles'): triangle_width = 2*math.pi * OuterTriangleRadius / TriangleCount - TriangleSeparation - for i in range(TriangleCount): - with Group(rotate=i / TriangleCount): - with Path(y=-OuterTriangleRadius, tags='triangle outer'): - MoveTo(-triangle_width / 2, 0) - LineTo(0, -TriangleHeight) - LineTo(triangle_width / 2, 0) - FillPath() - with Group('inner'): + for j in range(TriangleCount): + with Group(rotate=j / TriangleCount): + with Group(y=-OuterTriangleRadius, tags='triangle outer'): + with Path(fader=0.75): + MoveTo(-triangle_width / 2, 0) + LineTo(0, -TriangleHeight) + LineTo(0, 0) + FillPath() + with Path(): + MoveTo(0, 0) + LineTo(0, -TriangleHeight) + LineTo(triangle_width / 2, 0) + FillPath() + with Group('inner_triangles'): triangle_width = 2*math.pi * InnerTriangleRadius / TriangleCount - TriangleSeparation - for i in range(TriangleCount): - with Group(rotate=i / TriangleCount): - with Path(y=-InnerTriangleRadius, tags='triangle outer'): - MoveTo(-triangle_width / 2, 0) - LineTo(0, TriangleHeight) - LineTo(triangle_width / 2, 0) - FillPath() + for j in range(TriangleCount): + with Group(rotate=j / TriangleCount): + with Group(y=-InnerTriangleRadius, tags='triangle inner'): + with Path(fader=0.75): + MoveTo(-triangle_width / 2, 0) + LineTo(0, TriangleHeight) + LineTo(0, 0) + FillPath() + with Path(): + MoveTo(0, 0) + LineTo(0, TriangleHeight) + LineTo(triangle_width / 2, 0) + FillPath() #%% @@ -153,7 +179,18 @@ with Cue('Q3', name='Nightmare spots') as Q3: Match('#beads .odd').scale = 1.5 * sine(count) Match('#beads .even').scale = 1.5 * (1 - sine(count)) +with Cue('Q4', name='Rotating triangles'): + period = 5 + count = t / period + Match('.triangle.outer').rotate = count + Match('.triangle.outer').scale = 1 + 2*sine((count + i / n) * 3) + Match('.triangle.outer').y = -OuterTriangleRadius - TriangleHeight * sine((count + i / n) * 3) + Match('#inner_triangles').fader = 0 + #%% -client.start('#Q1') +client.stop('#Q1') +client.start('#Q2') +client.start('#Q4') +