#%% from flight.case import * from flight.expressions import * from constants import * #%% BPM = 118 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('#main_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 = Width / scale Match('#mask Rect').height = 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 Match('#symbol Text').text = 'â­ī¸' with Cue('Q08', name='Shrinking mask', fadeIn=1, fadeOut=1): period = 20 count = t / period Match('#main_mask').scale = 0.01 + sine(count) with Cue('Q09', name='Beating mask', fadeIn=1, fadeOut=1): period = 60 / BPM count = t / period beat = sawtooth(count, duty=0.25) Match('#main_mask').scale = 0.9 + 0.2 * impulse(beat) 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) * Width m.y = (uniform('Q21.y', i)[count] - 0.5) * 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 = 2 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) * Width m.y = (uniform('Q21.y', i)[count] - 0.5) * 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) / 5 m.scale = 50 m.x = (uniform('Q23.x')[i] - 0.5) * Width m.y = (uniform('Q23.y')[i] - 0.5) * Height m.rotate = count / 10 Match('.star .outline').color = hsv(hue, 0.75, 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) * Width * 2 * (count % 1) m.y = (uniform('Q24.y', i)[count] - 0.5) * Height * 2 * (count % 1) m.color = white(sine(count)) m.scale = count % 1 with Cue('Q25', name='Beating stars', fadeIn=1, fadeOut=1): period = 60 / BPM count = t / period beat = sawtooth(count, duty=0.25) Match('#stars').scale = 0.9 + 0.2 * impulse(beat) with Cue('Q31', name='Spirals', fadeIn=1, fadeOut=1): period = 10 count = t / period value = 0.25 + 0.75 * sine(1.3 * (count + meta.count / Spirals)) Match('#spirals').fader = 1 Match('#spirals').rotate = -count Match('.spiral .segment').lineWidth = 1.5 ** meta.index Match('.spiral .segment').color = hsv(count + meta.count / Spirals, meta.index / 8, value) with Cue('Q41', name='Tunnel', fadeIn=1, fadeOut=1): period = 2 count = t / period Match('#tunnel').fader = 1 Match('#tunnel .loop', mix=False).color = hsv(count - i/n, 1, 0.25 + 0.75 * i/n) Match('#tunnel', mix=False).scale = 1 + (TunnelLoopMultiplier - 1) * sawtooth(count) with Cue('Q51', name='Blowing bubbles', fadeIn=1, fadeOut=1): period = 6 phase = uniform('Q51.phase')[i] count = gt / period + phase Match('#bubbles').fader = 1 with Match('.bubble') as m: m.x = (uniform('Q51.x', i)[count] - 0.5) * Width * 2 * (count % 1) m.y = (uniform('Q51.y', i)[count] - 0.5) * Height * 2 * (count % 1) m.scale = uniform('Q51.scale', i)[count] * 10 Match('.bubble .inside').color = white(0.3 * sine(count)) Match('.bubble .outside').color = hsv(uniform('Q51.hue', i)[count], 0.8, sine(count))