Compare commits
3 Commits
472b456964
...
0a95017dee
Author | SHA1 | Date | |
---|---|---|---|
0a95017dee | |||
078426cda0 | |||
66d9f63af3 |
43
constants.py
Normal file
43
constants.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
from flight.color import Color
|
||||||
|
|
||||||
|
|
||||||
|
MaskOuterRadius = 460
|
||||||
|
MaskInnerRadius = 400
|
||||||
|
BeadSeparation = 15
|
||||||
|
BeadRadius = 5
|
||||||
|
EyeSeparation = 160
|
||||||
|
EyeXRadius = 140
|
||||||
|
EyeYRadius = 160
|
||||||
|
ThirdEyeOffset = 260
|
||||||
|
ThirdEyeXRadius = 200
|
||||||
|
ThirdEyeYRadius = 150
|
||||||
|
PupilHeight = 25
|
||||||
|
PupilWidth = 150
|
||||||
|
EyeRimThickness = 50
|
||||||
|
EyelinerThickness = 5
|
||||||
|
NoseHeight = 240
|
||||||
|
NoseWidth = 130
|
||||||
|
NoseBottom = 25
|
||||||
|
MouthOffset = 285
|
||||||
|
MouthWidth = 180
|
||||||
|
MouthHeight = 230
|
||||||
|
TongueHeight = 180
|
||||||
|
MouthCornerRadius = 20
|
||||||
|
LipThickness = 50
|
||||||
|
TriangleCount = 30
|
||||||
|
TriangleWidth = 60
|
||||||
|
TriangleHeight = 40
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
server = FlightServer.ensure_threaded_instance()
|
||||||
|
client = FlightClient('http://192.168.178.32:8888')
|
138
cues.py
Normal file
138
cues.py
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
#%%
|
||||||
|
|
||||||
|
import math
|
||||||
|
import random
|
||||||
|
|
||||||
|
from flight.case import *
|
||||||
|
from flight.color import Color
|
||||||
|
from flight.client import *
|
||||||
|
from flight.expressions import *
|
||||||
|
from flight.expressions import Expression
|
||||||
|
from flight.server import FlightServer
|
||||||
|
|
||||||
|
from constants import *
|
||||||
|
|
||||||
|
|
||||||
|
#%%
|
||||||
|
|
||||||
|
client.activate()
|
||||||
|
|
||||||
|
with Cue('Q01', name='Mask', fadeIn=5, fadeOut=5):
|
||||||
|
Match('#mask').fader = 1
|
||||||
|
|
||||||
|
with Cue('Q02', name='Rotating mask', fadeIn=1, fadeOut=2):
|
||||||
|
period = 11
|
||||||
|
count = t / period
|
||||||
|
Match('#master_mask').rotate = count % 1 * f
|
||||||
|
|
||||||
|
with Cue('Q03', name='Multiple masks'):
|
||||||
|
period = 3
|
||||||
|
scale = 1 / (1 + (t / period) // 1)
|
||||||
|
Match('#mask').scale = scale
|
||||||
|
Match('#mask Rect').width = container.width / scale
|
||||||
|
Match('#mask Rect').height = container.height / scale
|
||||||
|
|
||||||
|
with Cue('Q04', name='Blinking eyes') as Q2:
|
||||||
|
period = 3
|
||||||
|
duration = 0.2
|
||||||
|
count = t / period
|
||||||
|
cycle = t % period
|
||||||
|
offset = beta('Q04.offset')[count] * (period - duration)
|
||||||
|
blink = 1 - when((cycle > offset) & (cycle < offset + duration), impulse((cycle - offset) / duration), 0)
|
||||||
|
Match('.pupil > Rect').y = -PupilHeight / 2 * blink
|
||||||
|
Match('.pupil > Rect').height = PupilHeight * blink
|
||||||
|
|
||||||
|
with Cue('Q05', name='Talking'):
|
||||||
|
period = 0.5
|
||||||
|
duration = 0.1 + 0.2 * beta('Q04.duration')[count]
|
||||||
|
count = t / period
|
||||||
|
cycle = t % period
|
||||||
|
offset = beta('Q05.offset')[count] * (period - duration)
|
||||||
|
wag = when((cycle > offset) & (cycle < offset + duration), impulse((cycle - offset) / duration), 0)
|
||||||
|
height = uniform('Q05.height')[count] * (TongueHeight - MouthCornerRadius * 2)
|
||||||
|
Match('.tongue > RoundedRect').height = TongueHeight - height * wag
|
||||||
|
|
||||||
|
with Cue('Q06', name='Emoji'):
|
||||||
|
emoji = ['😳', '🎁', '🎉', '🤗', '💃', '🍰', '😉', '😸', '🐄', '🍆', '❤️', '⭐️', '😎',
|
||||||
|
'🛑', '✋', '🏃♀️', '✈️', '☹️', '🤕', '😢', '👺', '💵', '💰', '🤑']
|
||||||
|
period = 0.5
|
||||||
|
count = t / period
|
||||||
|
character = choose(uniform('Q06')[count], emoji)
|
||||||
|
Match('#symbol Text').text = character
|
||||||
|
|
||||||
|
with Cue('Q07', name='Helmet', fadeIn=1, fadeOut=1):
|
||||||
|
Match('#helmet').fader = 1
|
||||||
|
|
||||||
|
with Cue('Q11', name='Rainbow triangles', fadeIn=1, fadeOut=1):
|
||||||
|
period = 5
|
||||||
|
count = t / period
|
||||||
|
color = hsv(count + i / n, 1, 1)
|
||||||
|
Match('.triangle .left').color = color
|
||||||
|
Match('.triangle .right').color = color * 0.9
|
||||||
|
|
||||||
|
with Cue('Q12', name='Rotating triangles') as Q1:
|
||||||
|
period = 9 / maximum(f, 1e-6)
|
||||||
|
count = t / period
|
||||||
|
Match('#triangles').rotate = count
|
||||||
|
|
||||||
|
with Cue('Q13', name='Spinning triangles', fadeIn=1, fadeOut=1):
|
||||||
|
period = 5
|
||||||
|
count = t / period
|
||||||
|
scale = 2*sine((count + i / n) * 5)
|
||||||
|
Match('.triangle').rotate = count
|
||||||
|
Match('.triangle').scale = 1 + scale
|
||||||
|
Match('.triangle').y = -TriangleRadius - TriangleHeight * scale
|
||||||
|
|
||||||
|
with Cue('Q14', name='Nightmare spots') as Q3:
|
||||||
|
period = 1
|
||||||
|
count = t / period
|
||||||
|
Match('.bead.odd').scale = 2 * sine(count)
|
||||||
|
Match('.bead.even').scale = 2 * (1 - sine(count))
|
||||||
|
|
||||||
|
with Cue('Q21', name='Twinkling stars', fadeIn=1, fadeOut=1):
|
||||||
|
period = 1
|
||||||
|
phase = uniform('Q21.phase')[i]
|
||||||
|
count = gt / period + phase
|
||||||
|
Match('#stars').fader = 1
|
||||||
|
with Match('.star') as m:
|
||||||
|
m.x = (uniform('Q21.x', i)[count] - 0.5) * screen.width
|
||||||
|
m.y = (uniform('Q21.y', i)[count] - 0.5) * screen.height
|
||||||
|
Match('.star').scale = uniform('Q21.scale', i)[count]
|
||||||
|
Match('.star .fill').color = white(sine(count))
|
||||||
|
|
||||||
|
with Cue('Q22', name='Bouncing stars', fadeIn=1, fadeOut=1):
|
||||||
|
period = 1
|
||||||
|
phase = uniform('Q21.phase')[i]
|
||||||
|
count = gt / period + phase
|
||||||
|
Match('#stars').fader = 1
|
||||||
|
with Match('.star') as m:
|
||||||
|
m.x = (uniform('Q21.x', i)[count] - 0.5) * screen.width
|
||||||
|
m.y = (uniform('Q21.y', i)[count] - 0.5) * screen.height
|
||||||
|
m.rotate = count / 5
|
||||||
|
m.scale = bounce(count) * 25
|
||||||
|
Match('.star .outline').color = hsv(uniform('Q22.hue', i)[count], 1, bounce(count))
|
||||||
|
|
||||||
|
with Cue('Q23', name='Thin stars', fadeIn=1, fadeOut=1):
|
||||||
|
period = 9 + beta('Q23.period')[i] * 2
|
||||||
|
phase = uniform('Q23.phase')[i]
|
||||||
|
count = t / period + phase
|
||||||
|
hue = quad(count, uniform('Q23.hue', i)[count], uniform('Q23.hue', i)[count + 1])
|
||||||
|
Match('#stars').fader = 1
|
||||||
|
with Match('.star') as m:
|
||||||
|
m.lineWidth = sine(count) / 10
|
||||||
|
m.scale = 50
|
||||||
|
m.x = (uniform('Q23.x')[i] - 0.5) * screen.width
|
||||||
|
m.y = (uniform('Q23.y')[i] - 0.5) * screen.height
|
||||||
|
m.rotate = count / 10
|
||||||
|
Match('.star .outline').color = hsv(hue, 0.8, 1)
|
||||||
|
|
||||||
|
with Cue('Q24', name='Rushing stars', fadeIn=1, fadeOut=1):
|
||||||
|
period = 3
|
||||||
|
phase = uniform('Q21.phase')[i]
|
||||||
|
count = gt / period + phase
|
||||||
|
Match('#stars').fader = 1
|
||||||
|
with Match('.star') as m:
|
||||||
|
m.x = (uniform('Q24.x', i)[count] - 0.5) * screen.width * 2 * (count % 1)
|
||||||
|
m.y = (uniform('Q24.y', i)[count] - 0.5) * screen.height * 2 * (count % 1)
|
||||||
|
m.color = white(sine(count))
|
||||||
|
m.scale = count % 1
|
245
innernaut.py
245
innernaut.py
@ -1,245 +0,0 @@
|
|||||||
#%%
|
|
||||||
|
|
||||||
import math
|
|
||||||
import random
|
|
||||||
|
|
||||||
from flight.case import *
|
|
||||||
from flight.color import Color
|
|
||||||
from flight.client import *
|
|
||||||
from flight.expressions import *
|
|
||||||
from flight.expressions import Expression
|
|
||||||
from flight.server import FlightServer
|
|
||||||
|
|
||||||
|
|
||||||
#server = FlightServer.ensure_threaded_instance()
|
|
||||||
client = FlightClient('http://flight.local:8888')
|
|
||||||
|
|
||||||
|
|
||||||
#%%
|
|
||||||
|
|
||||||
client.activate()
|
|
||||||
|
|
||||||
MaskOuterRadius = 460
|
|
||||||
MaskInnerRadius = 400
|
|
||||||
BeadSeparation = 15
|
|
||||||
BeadRadius = 5
|
|
||||||
EyeSeparation = 160
|
|
||||||
EyeXRadius = 140
|
|
||||||
EyeYRadius = 160
|
|
||||||
ThirdEyeOffset = 260
|
|
||||||
ThirdEyeXRadius = 200
|
|
||||||
ThirdEyeYRadius = 150
|
|
||||||
PupilHeight = 25
|
|
||||||
PupilWidth = 150
|
|
||||||
EyeRimThickness = 50
|
|
||||||
EyelinerThickness = 5
|
|
||||||
NoseHeight = 240
|
|
||||||
NoseWidth = 130
|
|
||||||
NoseBottom = 25
|
|
||||||
MouthOffset = 285
|
|
||||||
MouthWidth = 180
|
|
||||||
MouthHeight = 230
|
|
||||||
TongueHeight = 180
|
|
||||||
MouthCornerRadius = 20
|
|
||||||
LipThickness = 50
|
|
||||||
TriangleCount = 30
|
|
||||||
TriangleWidth = 60
|
|
||||||
TriangleHeight = 40
|
|
||||||
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, color=TriangleColor, **kwargs):
|
|
||||||
with Group(**kwargs):
|
|
||||||
for side, multiplier in [('left', -1), ('right', 1)]:
|
|
||||||
with Path(tags=side, color=color * (0.8 - 0.1 * multiplier)):
|
|
||||||
MoveTo(multiplier * width / 2, height / 2)
|
|
||||||
LineTo(0, -height / 2)
|
|
||||||
LineTo(0, height / 2 - bottom)
|
|
||||||
FillPath()
|
|
||||||
if bottom:
|
|
||||||
with Path(tags='bottom', color=color * 0.8):
|
|
||||||
MoveTo(-width / 2, height / 2)
|
|
||||||
LineTo(0, height / 2 - bottom)
|
|
||||||
LineTo(width / 2, height / 2)
|
|
||||||
FillPath()
|
|
||||||
|
|
||||||
|
|
||||||
with Screen('main', width=1920, height=1080) as screen:
|
|
||||||
with Pattern('beads', width=BeadSeparation * 2, height=BeadSeparation * 2) as beads:
|
|
||||||
for x 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 Path(tags={'bead', 'odd' if odd else 'even'}, color=OddBeadColor if odd else EvenBeadColor):
|
|
||||||
Ellipse(0, 0, BeadRadius, BeadRadius)
|
|
||||||
FillPath()
|
|
||||||
with Group('stars', color='white', composite='lighter'):
|
|
||||||
for j in range(100):
|
|
||||||
radius = 10
|
|
||||||
with Path(x=screen.width / 2, y=screen.height / 2, tags='star'):
|
|
||||||
MoveTo(radius / 2, 0)
|
|
||||||
for k in range(1, 10):
|
|
||||||
theta = 2 * math.pi * k / 10
|
|
||||||
r = (1 + (k % 2)) * radius / 2
|
|
||||||
LineTo(r * math.cos(theta), r * math.sin(theta))
|
|
||||||
ClosePath()
|
|
||||||
FillPath()
|
|
||||||
with Group('mask', color=MaskColor, x=screen.width/2, y=screen.height/2, fader=0):
|
|
||||||
with Path(tags='background'):
|
|
||||||
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
|
||||||
FillPath()
|
|
||||||
with Path(tags='background patterning', pattern='beads'):
|
|
||||||
Ellipse(x=0, y=0, radiusX=MaskInnerRadius, radiusY=MaskInnerRadius)
|
|
||||||
FillPath()
|
|
||||||
with Group('triangles'):
|
|
||||||
for j in range(TriangleCount):
|
|
||||||
with Group(rotate=j / TriangleCount):
|
|
||||||
SplitTriangle(y=-TriangleRadius, tags='triangle', width=TriangleWidth, height=TriangleHeight)
|
|
||||||
with Group('mouth', y=MouthOffset):
|
|
||||||
with Path(tags='lips background'):
|
|
||||||
RoundedRect(-MouthWidth / 2 - LipThickness, -MouthHeight / 2 - LipThickness,
|
|
||||||
MouthWidth + LipThickness * 2, MouthHeight + LipThickness * 2, MouthCornerRadius + LipThickness)
|
|
||||||
FillPath()
|
|
||||||
with Path(tags='hole', color=HoleColor):
|
|
||||||
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
|
||||||
FillPath()
|
|
||||||
with Path(tags='tongue inside', color=DarkMaskColor, y=MouthHeight / 2, rotate=0.5):
|
|
||||||
RoundedRect(-MouthWidth / 2, 0, MouthWidth, TongueHeight, MouthCornerRadius)
|
|
||||||
FillPath()
|
|
||||||
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
|
||||||
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
|
||||||
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, NotoEmoji, emoji', 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'):
|
|
||||||
for side, multiplier in [('left', -1), ('right', 1)]:
|
|
||||||
with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeXRadius)):
|
|
||||||
with Path(tags='inside', color=DarkMaskColor):
|
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
|
||||||
FillPath()
|
|
||||||
SplitTriangle(tags='eyelid upper', y=-EyeYRadius / 2, width=TriangleWidth, height=TriangleHeight)
|
|
||||||
SplitTriangle(tags='eyelid lower', y=EyeYRadius / 2, width=TriangleWidth, height=-TriangleHeight)
|
|
||||||
with Path():
|
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
|
||||||
with Path(tags='pupil hole', color=HoleColor):
|
|
||||||
Rect(-PupilWidth / 2, -PupilHeight / 2, PupilWidth, PupilHeight)
|
|
||||||
FillPath()
|
|
||||||
with Path(tags='rim background', lineWidth=EyeRimThickness):
|
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius + EyeRimThickness/2, radiusY=EyeYRadius + EyeRimThickness / 2)
|
|
||||||
StrokePath()
|
|
||||||
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
|
||||||
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
|
||||||
StrokePath()
|
|
||||||
SplitTriangle(id='nose', width=NoseWidth, height=NoseHeight, bottom=NoseBottom)
|
|
||||||
|
|
||||||
|
|
||||||
#%%
|
|
||||||
|
|
||||||
client.activate()
|
|
||||||
|
|
||||||
with Cue('Q00', name='Mask', fadeIn=5, fadeOut=5):
|
|
||||||
Match('#mask').fader = 1
|
|
||||||
|
|
||||||
with Cue('Q01', name='Rotating triangles') as Q1:
|
|
||||||
period = 9 / maximum(f, 1e-6)
|
|
||||||
count = t / period
|
|
||||||
Match('#triangles').rotate = count
|
|
||||||
|
|
||||||
with Cue('Q02', name='Blinking eyes') as Q2:
|
|
||||||
period = 3
|
|
||||||
duration = 0.2
|
|
||||||
count = t / period
|
|
||||||
cycle = t % period
|
|
||||||
offset = beta('Q2.offset')[count] * (period - duration)
|
|
||||||
blink = 1 - when((cycle > offset) & (cycle < offset + duration), impulse((cycle - offset) / duration), 0)
|
|
||||||
Match('.pupil > Rect').y = -PupilHeight / 2 * blink
|
|
||||||
Match('.pupil > Rect').height = PupilHeight * blink
|
|
||||||
|
|
||||||
with Cue('Q03', name='Nightmare spots') as Q3:
|
|
||||||
period = 1
|
|
||||||
count = t / period
|
|
||||||
Match('.bead.odd').scale = 2 * sine(count)
|
|
||||||
Match('.bead.even').scale = 2 * (1 - sine(count))
|
|
||||||
|
|
||||||
with Cue('Q04', name='Spinning triangles', fadeIn=1, fadeOut=1):
|
|
||||||
period = 5
|
|
||||||
count = t / period
|
|
||||||
scale = 2*sine((count + i / n) * 5)
|
|
||||||
Match('.triangle').rotate = count
|
|
||||||
Match('.triangle').scale = 1 + scale
|
|
||||||
Match('.triangle').y = -TriangleRadius - TriangleHeight * scale
|
|
||||||
|
|
||||||
with Cue('Q05', name='Talking'):
|
|
||||||
period = 0.5
|
|
||||||
duration = 0.1 + 0.2 * beta('Q5.duration')[count]
|
|
||||||
count = t / period
|
|
||||||
cycle = t % period
|
|
||||||
offset = beta('Q5.offset')[count] * (period - duration)
|
|
||||||
wag = when((cycle > offset) & (cycle < offset + duration), impulse((cycle - offset) / duration), 0)
|
|
||||||
height = uniform('Q5.height')[count] * (TongueHeight - MouthCornerRadius * 2)
|
|
||||||
Match('.tongue > RoundedRect').height = TongueHeight - height * wag
|
|
||||||
|
|
||||||
with Cue('Q06', name='Rotating mask', fadeIn=1, fadeOut=2):
|
|
||||||
period = 11
|
|
||||||
count = t / period
|
|
||||||
Match('#mask').rotate = count % 1 * f
|
|
||||||
|
|
||||||
with Cue('Q07', name='Rainbow triangles', fadeIn=1, fadeOut=1):
|
|
||||||
period = 5
|
|
||||||
count = t / period
|
|
||||||
color = hsv(count + i / n, 1, 1)
|
|
||||||
Match('.triangle .left').color = color
|
|
||||||
Match('.triangle .right').color = color * 0.9
|
|
||||||
|
|
||||||
with Cue('Q08', name='Twinkling stars', fadeIn=1, fadeOut=1):
|
|
||||||
period = 1
|
|
||||||
phase = uniform('Q8.phase')[i]
|
|
||||||
count = gt / period + phase
|
|
||||||
with Match('.star') as m:
|
|
||||||
m.x = uniform('Q8.x', i)[count] * screen.width
|
|
||||||
m.y = uniform('Q8.y', i)[count] * screen.height
|
|
||||||
with Match('.star') as m:
|
|
||||||
m.scale = uniform('Q8.scale', i)[count]
|
|
||||||
m.color = white(sine(count))
|
|
||||||
|
|
||||||
with Cue('Q09', name='Emoji'):
|
|
||||||
emoji = '😳🎁🎉🤗💃🍰😉'
|
|
||||||
period = 0.5
|
|
||||||
count = t / period
|
|
||||||
Match('#thirdeye Text').text = Expression.coerce(emoji)[count % len(emoji)]
|
|
||||||
|
|
||||||
with Cue('Q10', name='Bouncing stars', fadeIn=1, fadeOut=1):
|
|
||||||
period = 1
|
|
||||||
phase = uniform('Q8.phase')[i]
|
|
||||||
count = gt / period + phase
|
|
||||||
with Match('.star') as m:
|
|
||||||
m.x = uniform('Q8.x', i)[count] * screen.width
|
|
||||||
m.y = uniform('Q8.y', i)[count] * screen.height
|
|
||||||
with Match('.star') as m:
|
|
||||||
m.rotate = count / 5
|
|
||||||
m.scale = bounce(count) * 25
|
|
||||||
m.color = hsv(uniform('Q10.hue', i)[count], 1, bounce(count))
|
|
||||||
|
|
||||||
|
|
||||||
#%%
|
|
||||||
|
|
||||||
client.stop('#Q1')
|
|
||||||
client.start('#Q2')
|
|
||||||
client.stop('#Q3')
|
|
||||||
client.stop('#Q4')
|
|
135
setup.py
Normal file
135
setup.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
#%%
|
||||||
|
|
||||||
|
import math
|
||||||
|
import random
|
||||||
|
|
||||||
|
from flight.case import *
|
||||||
|
from flight.color import Color
|
||||||
|
from flight.client import *
|
||||||
|
from flight.expressions import *
|
||||||
|
from flight.expressions import Expression
|
||||||
|
from flight.server import FlightServer
|
||||||
|
|
||||||
|
from constants import *
|
||||||
|
|
||||||
|
|
||||||
|
#%%
|
||||||
|
|
||||||
|
client.activate()
|
||||||
|
|
||||||
|
def SplitTriangle(width, height, bottom=0, color=TriangleColor, **kwargs):
|
||||||
|
with Group(**kwargs):
|
||||||
|
for side, multiplier in [('left', -1), ('right', 1)]:
|
||||||
|
with Path(tags=side, color=color * (0.8 - 0.1 * multiplier)):
|
||||||
|
MoveTo(multiplier * width / 2, height / 2)
|
||||||
|
LineTo(0, -height / 2)
|
||||||
|
LineTo(0, height / 2 - bottom)
|
||||||
|
FillPath()
|
||||||
|
if bottom:
|
||||||
|
with Path(tags='bottom', color=color * 0.8):
|
||||||
|
MoveTo(-width / 2, height / 2)
|
||||||
|
LineTo(0, height / 2 - bottom)
|
||||||
|
LineTo(width / 2, height / 2)
|
||||||
|
FillPath()
|
||||||
|
|
||||||
|
|
||||||
|
def Star(radius):
|
||||||
|
MoveTo(radius / 2, 0)
|
||||||
|
for k in range(1, 10):
|
||||||
|
theta = 2 * math.pi * k / 10
|
||||||
|
r = (1 + (k % 2)) * radius / 2
|
||||||
|
LineTo(r * math.cos(theta), r * math.sin(theta))
|
||||||
|
ClosePath()
|
||||||
|
|
||||||
|
|
||||||
|
with Screen('main', width=1920, height=1080) as screen:
|
||||||
|
with Pattern('beads', width=BeadSeparation * 2, height=BeadSeparation * 2) as beads:
|
||||||
|
for x 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 Path(tags={'bead', 'odd' if odd else 'even'}, color=OddBeadColor if odd else EvenBeadColor):
|
||||||
|
Ellipse(0, 0, BeadRadius, BeadRadius)
|
||||||
|
FillPath()
|
||||||
|
with Pattern('mask_pattern', width=screen.width, height=screen.height) as container:
|
||||||
|
with Group('master_mask', color=MaskColor, x=container.width/2, y=container.height/2):
|
||||||
|
with Path(tags='background'):
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='background patterning', pattern='beads'):
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskInnerRadius, radiusY=MaskInnerRadius)
|
||||||
|
FillPath()
|
||||||
|
with Group('triangles'):
|
||||||
|
for j in range(TriangleCount):
|
||||||
|
with Group(rotate=j / TriangleCount):
|
||||||
|
SplitTriangle(y=-TriangleRadius, tags='triangle', width=TriangleWidth, height=TriangleHeight)
|
||||||
|
with Group('mouth', y=MouthOffset):
|
||||||
|
with Path(tags='lips background'):
|
||||||
|
RoundedRect(-MouthWidth / 2 - LipThickness, -MouthHeight / 2 - LipThickness,
|
||||||
|
MouthWidth + LipThickness * 2, MouthHeight + LipThickness * 2, MouthCornerRadius + LipThickness)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='hole', color=HoleColor):
|
||||||
|
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='tongue inside', color=DarkMaskColor, y=MouthHeight / 2, rotate=0.5):
|
||||||
|
RoundedRect(-MouthWidth / 2, 0, MouthWidth, TongueHeight, MouthCornerRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
|
RoundedRect(-MouthWidth / 2, -MouthHeight / 2, MouthWidth, MouthHeight, MouthCornerRadius)
|
||||||
|
StrokePath()
|
||||||
|
with Group('thirdeye', x=0, y=-ThirdEyeOffset):
|
||||||
|
with Path(tags='background'):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius, radiusY=ThirdEyeYRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius - EyeRimThickness, radiusY=ThirdEyeYRadius - EyeRimThickness)
|
||||||
|
StrokePath()
|
||||||
|
with Group('eyes'):
|
||||||
|
for side, multiplier in [('left', -1), ('right', 1)]:
|
||||||
|
with Group(tags={'eye', side}, x=multiplier * (EyeSeparation/2 + EyeXRadius)):
|
||||||
|
with Path(tags='inside', color=DarkMaskColor):
|
||||||
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
|
FillPath()
|
||||||
|
SplitTriangle(tags='eyelid upper', y=-EyeYRadius / 2, width=TriangleWidth, height=TriangleHeight)
|
||||||
|
SplitTriangle(tags='eyelid lower', y=EyeYRadius / 2, width=TriangleWidth, height=-TriangleHeight)
|
||||||
|
with Path():
|
||||||
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
|
with Path(tags='pupil hole', color=HoleColor):
|
||||||
|
Rect(-PupilWidth / 2, -PupilHeight / 2, PupilWidth, PupilHeight)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='rim background', lineWidth=EyeRimThickness):
|
||||||
|
Ellipse(x=0, y=0, radiusX=EyeXRadius + EyeRimThickness/2, radiusY=EyeYRadius + EyeRimThickness / 2)
|
||||||
|
StrokePath()
|
||||||
|
with Path(tags='liner', color=EyelinerColor, lineWidth=EyelinerThickness, lineDash=EyelinerThickness):
|
||||||
|
Ellipse(x=0, y=0, radiusX=EyeXRadius, radiusY=EyeYRadius)
|
||||||
|
StrokePath()
|
||||||
|
SplitTriangle(id='nose', width=NoseWidth, height=NoseHeight, bottom=NoseBottom)
|
||||||
|
with Group('helmet', fader=0):
|
||||||
|
with Path(color=TriangleColor * 0.5, fader=0.6):
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
||||||
|
FillPath()
|
||||||
|
with Path(color='white', lineWidth=10):
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius)
|
||||||
|
StrokePath()
|
||||||
|
with Group(color='white'):
|
||||||
|
with Path():
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius, startAngle=0.15, endAngle=0.35)
|
||||||
|
FillPath()
|
||||||
|
with Path():
|
||||||
|
Ellipse(x=0, y=0, radiusX=MaskOuterRadius, radiusY=MaskOuterRadius, startAngle=0.55, endAngle=0.95)
|
||||||
|
FillPath()
|
||||||
|
with Path(id='symbol', x=0, y=-ThirdEyeOffset):
|
||||||
|
Ellipse(0, 0, radiusX=ThirdEyeXRadius - EyeRimThickness, radiusY=ThirdEyeYRadius - EyeRimThickness)
|
||||||
|
Text(font='120px NotoColorEmoji, NotoEmoji, emoji', textAlign='center', textBaseline='middle', color=HoleColor)
|
||||||
|
with Group('stars', composite='lighter', x=screen.width / 2, y=screen.height / 2, fader=0):
|
||||||
|
for j in range(100):
|
||||||
|
with Group(tags='star', lineWidth=2):
|
||||||
|
with Path(tags='fill'):
|
||||||
|
Star(10)
|
||||||
|
FillPath()
|
||||||
|
with Path(tags='outline'):
|
||||||
|
Star(10)
|
||||||
|
StrokePath()
|
||||||
|
with Path(id='mask', pattern='mask_pattern', fader=0):
|
||||||
|
Rect(0, 0, container.width, container.height)
|
||||||
|
FillPath()
|
Reference in New Issue
Block a user