def setup(canvas):
    index = 0
    global circles; circles = []
    max_index = len(SMS_ID_LIST) - 1
    for sms in SMS_ID_LIST:
        if index < max_index:
        # Create a group of n cells.
        # Smoothstep yields more numbers near 1.0 than near 0.0, 
        # so we'll got mostly empty blue cells.
            t = smoothstep(0, max_index, index)
            sms_id = SMS_ID_LIST[index][0]
            message = Circle(x = random(-100), # Start offscreen to the left.
                   y = random(canvas.height), 
              radius = 10 + 0.5 * t*index, sms_id=sms_id)
            message.form_Message()
            circles.append(message)
            index += 1
        else:
            t = smoothstep(0, max_index, index)
            sms_id = SMS_ID_LIST[max_index][0]
            message = Circle(x = random(-100), # Start offscreen to the left.
                   y = random(canvas.height), 
              radius = 10 + 0.5 * t*index, sms_id=sms_id)
            message.form_Message()
            circles.append(message)
def setup(canvas):
    n = 60
    global circles; circles = []
    for i in range(n):
        # Create a group of n cells.
        # Smoothstep yields more numbers near 1.0 than near 0.0, 
        # so we'll got mostly empty blue cells.
        t = smoothstep(0, n, i)
        circles.append(
            Circle(x = random(-100), # Start offscreen to the left.
                   y = random(canvas.height), 
              radius = 10 + 0.5 * t*i, # Make the blue cells bigger.
               text='hello'))
def setup(canvas):
    n = 60
    global circles
    circles = []
    for i in range(n):
        # Create a group of n cells.
        # Smoothstep yields more numbers near 1.0 than near 0.0,
        # so we'll got mostly empty blue cells.
        t = smoothstep(0, n, i)
        circles.append(
            Circle(
                x=random(-100),  # Start offscreen to the left.
                y=random(canvas.height),
                radius=10 + 0.5 * t * i,  # Make the blue cells bigger.
                image=cell(t)))
Example #4
0
def draw(canvas):
    
    canvas.clear()

    translate(250, 250)
    scale(0.5)

    t = canvas.frame % 100 * 0.01 # A number between 0.0 and 1.0.
    t = smoothstep(0.0, 1.0, t)   # Slow down ("ease") when nearing 0.0 or 1.0.
    rotate(t * 360)
    
    m = 1.0 - 2 * abs(0.5-t) # A number that goes from 0.0 to 1.0 and then back to 0.0.
    scale(0.5+m)
    
    # The image command has an optional "color" and an optional "alpha" parameter.
    # The alpha sets the overall opacity of the image (alpha=0.25 means 75% transparent).
    # The color adjusts the fill color of the image. By default it is (1,1,1,1),
    # which means that the image pixels are mixed with white and remain unaffected.
    # In this case, we lower the green component,
    # so the creature gets more pink when it flies.
    image(img, x=0, y=-img.height, color=color(1, 1-m, 1, 1), alpha=1.0)
Example #5
0
def draw(canvas):

    canvas.clear()

    translate(250, 250)
    scale(0.5)

    t = canvas.frame % 100 * 0.01  # A number between 0.0 and 1.0.
    t = smoothstep(0.0, 1.0, t)  # Slow down ("ease") when nearing 0.0 or 1.0.
    rotate(t * 360)

    m = 1.0 - 2 * abs(
        0.5 - t)  # A number that goes from 0.0 to 1.0 and then back to 0.0.
    scale(0.5 + m)

    # The image command has an optional "color" and an optional "alpha" parameter.
    # The alpha sets the overall opacity of the image (alpha=0.25 means 75% transparent).
    # The color adjusts the fill color of the image. By default it is (1,1,1,1),
    # which means that the image pixels are mixed with white and remain unaffected.
    # In this case, we lower the green component,
    # so the creature gets more pink when it flies.
    image(img, x=0, y=-img.height, color=color(1, 1 - m, 1, 1), alpha=1.0)