WIP
This commit is contained in:
BIN
fonts/NotoColorEmoji-normal-normal.ttf
Normal file
BIN
fonts/NotoColorEmoji-normal-normal.ttf
Normal file
Binary file not shown.
95
innernaut.py
95
innernaut.py
@ -1,23 +1,18 @@
|
|||||||
#%%
|
#%%
|
||||||
|
|
||||||
from flight.server import FlightServer
|
|
||||||
|
|
||||||
|
|
||||||
#server = FlightServer.ensure_threaded_instance()
|
|
||||||
|
|
||||||
|
|
||||||
#%%
|
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from flight.case import *
|
from flight.case import *
|
||||||
|
from flight.color import Color
|
||||||
from flight.client import *
|
from flight.client import *
|
||||||
from flight.expressions import *
|
from flight.expressions import *
|
||||||
|
from flight.expressions import Expression
|
||||||
|
from flight.server import FlightServer
|
||||||
|
|
||||||
|
|
||||||
client = FlightClient('http://mirror.local:8888')
|
#server = FlightServer.ensure_threaded_instance()
|
||||||
|
client = FlightClient('http://flight.local:8888')
|
||||||
|
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
@ -31,6 +26,9 @@ BeadRadius = 5
|
|||||||
EyeSeparation = 160
|
EyeSeparation = 160
|
||||||
EyeXRadius = 140
|
EyeXRadius = 140
|
||||||
EyeYRadius = 160
|
EyeYRadius = 160
|
||||||
|
ThirdEyeOffset = 260
|
||||||
|
ThirdEyeXRadius = 200
|
||||||
|
ThirdEyeYRadius = 150
|
||||||
PupilHeight = 25
|
PupilHeight = 25
|
||||||
PupilWidth = 150
|
PupilWidth = 150
|
||||||
EyeRimThickness = 50
|
EyeRimThickness = 50
|
||||||
@ -49,17 +47,25 @@ TriangleWidth = 60
|
|||||||
TriangleHeight = 40
|
TriangleHeight = 40
|
||||||
TriangleRadius = 430
|
TriangleRadius = 430
|
||||||
|
|
||||||
|
MaskColor = Color.hsv(0.09, 0.8, 0.25)
|
||||||
|
DarkMaskColor = MaskColor * 0.25
|
||||||
|
TriangleColor = Color.hsv(0.11, 0.8, 1)
|
||||||
|
HoleColor = Color.white(1)
|
||||||
|
EyelinerColor = Color.green(0.5)
|
||||||
|
OddBeadColor = Color.red(1)
|
||||||
|
EvenBeadColor = Color.white(0)
|
||||||
|
|
||||||
def SplitTriangle(width, height, bottom=0, **kwargs):
|
|
||||||
|
def SplitTriangle(width, height, bottom=0, color=TriangleColor, **kwargs):
|
||||||
with Group(**kwargs):
|
with Group(**kwargs):
|
||||||
for side, multiplier in [('left', -1), ('right', 1)]:
|
for side, multiplier in [('left', -1), ('right', 1)]:
|
||||||
with Path(tags=side):
|
with Path(tags=side, color=color * (0.8 - 0.1 * multiplier)):
|
||||||
MoveTo(multiplier * width / 2, height / 2)
|
MoveTo(multiplier * width / 2, height / 2)
|
||||||
LineTo(0, -height / 2)
|
LineTo(0, -height / 2)
|
||||||
LineTo(0, height / 2 - bottom)
|
LineTo(0, height / 2 - bottom)
|
||||||
FillPath()
|
FillPath()
|
||||||
if bottom:
|
if bottom:
|
||||||
with Path(tags='bottom'):
|
with Path(tags='bottom', color=color * 0.8):
|
||||||
MoveTo(-width / 2, height / 2)
|
MoveTo(-width / 2, height / 2)
|
||||||
LineTo(0, height / 2 - bottom)
|
LineTo(0, height / 2 - bottom)
|
||||||
LineTo(width / 2, height / 2)
|
LineTo(width / 2, height / 2)
|
||||||
@ -70,8 +76,9 @@ with Screen('main', width=1920, height=1200) as screen:
|
|||||||
with Pattern('beads', width=BeadSeparation * 2, height=BeadSeparation * 2) as beads:
|
with Pattern('beads', width=BeadSeparation * 2, height=BeadSeparation * 2) as beads:
|
||||||
for x in range(3):
|
for x in range(3):
|
||||||
for y in range(3):
|
for y in range(3):
|
||||||
|
odd = (x + y) % 2 == 1
|
||||||
with Group(x=x * beads.width / 2, y=(y + (x % 2) / 3) * beads.height / 2):
|
with Group(x=x * beads.width / 2, y=(y + (x % 2) / 3) * beads.height / 2):
|
||||||
with Path(tags={'bead', 'odd' if (x + y) % 2 == 1 else 'even'}):
|
with Path(tags={'bead', 'odd' if odd else 'even'}, color=OddBeadColor if odd else EvenBeadColor):
|
||||||
Ellipse(0, 0, BeadRadius, BeadRadius)
|
Ellipse(0, 0, BeadRadius, BeadRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Group('stars', color='white'):
|
with Group('stars', color='white'):
|
||||||
@ -85,11 +92,11 @@ with Screen('main', width=1920, height=1200) as screen:
|
|||||||
LineTo(r * math.cos(theta), r * math.sin(theta))
|
LineTo(r * math.cos(theta), r * math.sin(theta))
|
||||||
ClosePath()
|
ClosePath()
|
||||||
FillPath()
|
FillPath()
|
||||||
with Group('mask', x=screen.width/2, y=screen.height/2):
|
with Group('mask', color=MaskColor, x=screen.width/2, y=screen.height/2):
|
||||||
with Path(tags='background'):
|
with Path(tags='background'):
|
||||||
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Path(tags='background patterning'):
|
with Path(tags='background patterning', pattern='beads'):
|
||||||
Ellipse(x=0, y=0, radiusX=MaskInnerRadius, radiusY=MaskInnerRadius)
|
Ellipse(x=0, y=0, radiusX=MaskInnerRadius, radiusY=MaskInnerRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Group('triangles'):
|
with Group('triangles'):
|
||||||
@ -101,32 +108,42 @@ with Screen('main', width=1920, height=1200) as screen:
|
|||||||
RoundedRect(-MouthWidth / 2 - LipThickness, -MouthHeight / 2 - LipThickness,
|
RoundedRect(-MouthWidth / 2 - LipThickness, -MouthHeight / 2 - LipThickness,
|
||||||
MouthWidth + LipThickness * 2, MouthHeight + LipThickness * 2, MouthCornerRadius + LipThickness)
|
MouthWidth + LipThickness * 2, MouthHeight + LipThickness * 2, MouthCornerRadius + LipThickness)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Path(tags='hole'):
|
with Path(tags='hole', color=HoleColor):
|
||||||
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Path(tags='tongue inside', y=MouthHeight / 2, rotate=0.5):
|
with Path(tags='tongue inside', color=DarkMaskColor, y=MouthHeight / 2, rotate=0.5):
|
||||||
RoundedRect(-MouthWidth / 2, 0, MouthWidth, TongueHeight, MouthCornerRadius)
|
RoundedRect(-MouthWidth / 2, 0, MouthWidth, TongueHeight, MouthCornerRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Path(tags='liner', lineWidth=EyelinerThickness):
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
||||||
StrokePath()
|
StrokePath()
|
||||||
|
with Group('thirdeye', x=0, y=-ThirdEyeOffset):
|
||||||
|
with Path(tags='background'):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius, radiusY=ThirdEyeYRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='inside'):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius - EyeRimThickness, radiusY=ThirdEyeYRadius - EyeRimThickness)
|
||||||
|
Text(font='120px NotoColorEmoji', textAlign='center', textBaseline='middle', color=HoleColor)
|
||||||
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius - EyeRimThickness, radiusY=ThirdEyeYRadius - EyeRimThickness)
|
||||||
|
StrokePath()
|
||||||
with Group('eyes'):
|
with Group('eyes'):
|
||||||
for side, multiplier in [('left', -1), ('right', 1)]:
|
for side, multiplier in [('left', -1), ('right', 1)]:
|
||||||
with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeXRadius)):
|
with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeXRadius)):
|
||||||
with Path(tags='inside'):
|
with Path(tags='inside', color=DarkMaskColor):
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
FillPath()
|
FillPath()
|
||||||
SplitTriangle(tags='eyelid upper', y=-EyeYRadius / 2, width=TriangleWidth, height=TriangleHeight)
|
SplitTriangle(tags='eyelid upper', y=-EyeYRadius / 2, width=TriangleWidth, height=TriangleHeight)
|
||||||
SplitTriangle(tags='eyelid lower', y=EyeYRadius / 2, width=TriangleWidth, height=-TriangleHeight)
|
SplitTriangle(tags='eyelid lower', y=EyeYRadius / 2, width=TriangleWidth, height=-TriangleHeight)
|
||||||
with Path():
|
with Path():
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
with Path(tags='pupil hole'):
|
with Path(tags='pupil hole', color=HoleColor):
|
||||||
Rect(-PupilWidth / 2, -PupilHeight / 2, PupilWidth, PupilHeight)
|
Rect(-PupilWidth / 2, -PupilHeight / 2, PupilWidth, PupilHeight)
|
||||||
FillPath()
|
FillPath()
|
||||||
with Path(tags='rim background', lineWidth=EyeRimThickness):
|
with Path(tags='rim background', lineWidth=EyeRimThickness):
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius + EyeRimThickness/2, radiusY=EyeYRadius + EyeRimThickness / 2)
|
Ellipse(x=0, y=0, radiusX=EyeXRadius + EyeRimThickness/2, radiusY=EyeYRadius + EyeRimThickness / 2)
|
||||||
StrokePath()
|
StrokePath()
|
||||||
with Path(tags='liner', lineWidth=EyelinerThickness):
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
StrokePath()
|
StrokePath()
|
||||||
SplitTriangle(id='nose', width=NoseWidth, height=NoseHeight, bottom=NoseBottom)
|
SplitTriangle(id='nose', width=NoseWidth, height=NoseHeight, bottom=NoseBottom)
|
||||||
@ -136,24 +153,8 @@ with Screen('main', width=1920, height=1200) as screen:
|
|||||||
|
|
||||||
client.activate()
|
client.activate()
|
||||||
|
|
||||||
with Cue('Q0', name='Standard colours') as Q0:
|
with Cue('Q1', name='Rotating triangles') as Q1:
|
||||||
gold = hsv(0.11, 0.8, 1)
|
period = 9
|
||||||
brown = hsv(0.09, 0.8, 0.25);
|
|
||||||
Match('.background').color = brown
|
|
||||||
Match('.patterning').pattern = 'beads'
|
|
||||||
Match('#beads .odd').color = red(1)
|
|
||||||
Match('#beads .even').color = white(0)
|
|
||||||
Match('.hole').color = white(1)
|
|
||||||
Match('.inside').color = brown * 0.25
|
|
||||||
Match('.left').color = gold
|
|
||||||
Match('.right').color = gold * 0.9
|
|
||||||
Match('.bottom').color = gold * 0.8
|
|
||||||
Match('.liner').color = green(0.5)
|
|
||||||
Match('.liner').lineDash = EyelinerThickness
|
|
||||||
|
|
||||||
|
|
||||||
with Cue('Q1', name='Spinning triangles') as Q1:
|
|
||||||
period = 10
|
|
||||||
count = t / period
|
count = t / period
|
||||||
Match('#triangles').rotate = count
|
Match('#triangles').rotate = count
|
||||||
|
|
||||||
@ -173,11 +174,11 @@ with Cue('Q3', name='Nightmare spots') as Q3:
|
|||||||
Match('.bead.odd').scale = 2 * sine(count)
|
Match('.bead.odd').scale = 2 * sine(count)
|
||||||
Match('.bead.even').scale = 2 * (1 - sine(count))
|
Match('.bead.even').scale = 2 * (1 - sine(count))
|
||||||
|
|
||||||
with Cue('Q4', name='Rotating triangles'):
|
with Cue('Q4', name='Spinning triangles', fadeIn=1, fadeOut=1):
|
||||||
period = 5
|
period = 5
|
||||||
count = t / period
|
count = t / period
|
||||||
scale = 2*sine((count + i / n) * 5)
|
scale = 2*sine((count + i / n) * 5)
|
||||||
Match('.triangle').rotate = count
|
Match('.triangle').rotate = (count % 1) * f
|
||||||
Match('.triangle').scale = 1 + scale
|
Match('.triangle').scale = 1 + scale
|
||||||
Match('.triangle').y = -TriangleRadius - TriangleHeight * scale
|
Match('.triangle').y = -TriangleRadius - TriangleHeight * scale
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ with Cue('Q5', name='Talking'):
|
|||||||
Match('.tongue > RoundedRect').height = TongueHeight - height * wag
|
Match('.tongue > RoundedRect').height = TongueHeight - height * wag
|
||||||
|
|
||||||
with Cue('Q6', name='Rotating mask'):
|
with Cue('Q6', name='Rotating mask'):
|
||||||
period = 10
|
period = 11
|
||||||
count = t / period
|
count = t / period
|
||||||
Match('#mask').rotate = count
|
Match('#mask').rotate = count
|
||||||
|
|
||||||
@ -210,9 +211,17 @@ with Cue('Q8', name='Twinkling stars'):
|
|||||||
with Match('.star') as m:
|
with Match('.star') as m:
|
||||||
m.x = (beta('Q8.x', i)[count] + 0.5) % 1 * screen.width
|
m.x = (beta('Q8.x', i)[count] + 0.5) % 1 * screen.width
|
||||||
m.y = (beta('Q8.y', i)[count] + 0.5) % 1 * screen.height
|
m.y = (beta('Q8.y', i)[count] + 0.5) % 1 * screen.height
|
||||||
|
m.rotate = uniform('Q08.rotate', i)[count]
|
||||||
m.scale = uniform('Q8.scale', i)[count]
|
m.scale = uniform('Q8.scale', i)[count]
|
||||||
m.fader = sine(count)
|
m.fader = sine(count)
|
||||||
|
|
||||||
|
with Cue('Q9', name='Emoji'):
|
||||||
|
emoji = '😳🎁🎉🤗💃🍰😉'
|
||||||
|
period = 0.5
|
||||||
|
count = t / period
|
||||||
|
Match('#thirdeye Text').text = Expression.coerce(emoji)[count % len(emoji)]
|
||||||
|
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
|
|
||||||
client.start('#Q0')
|
client.start('#Q0')
|
||||||
|
Reference in New Issue
Block a user