1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Has anyone created any new effects yet??

Discussion in 'Hyperion General' started by Blayde, 22 June 2016.

  1. Blayde

    Blayde New Member

    Messages:
    2
    Hardware:
    RPi1/Zero
    Loving my setup so far, but I was wondering if anyone has programmed any new effects for Hyperion yet? If so, please share!
     
  2. Brindosch

    Brindosch Active Member

    Messages:
    678
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    I hope so that all available effects are currently at our repo

    If you may interested in effects development just have a look at the effects dir. You don't need much code for it :)
    Just a little bit digging :)
     
  3. mvaladas

    mvaladas New Member

    Messages:
    2
    Hardware:
    RPi2
    I've created a couple of flag effects for Euro 2016:

    IMG_4136.JPG
    Portugal Code:
    Code:
    import hyperion
    import time
    import colorsys
    
    # Initialize the led data
    leds = bytearray()
    
    # Do Portugal, width = 10
    # green
    for i in range(3):
        leds += bytearray((int(0), int(102), int(0)))
    
    # yellow
    for i in range(2):
        leds += bytearray((int(255), int(255), int(0)))
    
    # red
    for i in range(5):
        leds += bytearray((int(255), int(0), int(0)))
    
    while not hyperion.abort():
        hyperion.setImage(10,1,leds)
        time.sleep(5.0)
    
    IMG_4134.JPG
    France Code:
    Code:
    import hyperion
    import time
    import colorsys
    
    # Initialize the led data
    leds = bytearray()
    
    # Do France, width = 9
    # blue
    leds += bytearray((int(0), int(85), int(164)))
    leds += bytearray((int(0), int(85), int(164)))
    leds += bytearray((int(0), int(85), int(164)))
    
    # white
    leds += bytearray((int(255), int(255), int(255)))
    leds += bytearray((int(255), int(255), int(255)))
    leds += bytearray((int(255), int(255), int(255)))
    
    # red
    leds += bytearray((int(239), int(65), int(53)))
    leds += bytearray((int(239), int(65), int(53)))
    leds += bytearray((int(239), int(65), int(53)))
    
    while not hyperion.abort():
        hyperion.setImage(9,1,leds)
        time.sleep(5.0)
    
    Feel free to make the matches more enjoyable.
     
    • Like Like x 1
  4. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
    @mvaladas perhaps you want to combine your flags into one effect file and make it selectable via a json config file (like the cinema lights effect (fade.py))
    and then contribute to hyperion ... perhaps you/other can make more flags?

    @Blayde I created some effects, they are already in hyperion available.
     
  5. Seb Atkins

    Seb Atkins New Member

    Messages:
    6
    Hardware:
    RPi3
    @mvaladas i know this is an old thread,

    I am really interested in your flag effects! i am trying to accomplish something similar except i require the flags to scroll in and out of my matrix, How would i go about acheiving this?
    have you created any more flags since?

    Cheers
     
  6. Seb Atkins

    Seb Atkins New Member

    Messages:
    6
    Hardware:
    RPi3
    @redPanther is this something you would be able to help me with, i am happy to do the work myself but require a little guidance as i have a short time frame to acheive this
     
  7. mvaladas

    mvaladas New Member

    Messages:
    2
    Hardware:
    RPi2
    @Seb Atkins I did the effects for the Euro 2016 to watch some matches at home with friends. After that I never gave them any more thought.
    Scrolling in and out should not be too difficult. The way I thought about it, each flag is a single row of coloured pixels. I used 9 instead of 3 for the french flag because it made the colors line up better, but in theory you should only need 3 pixels for the red, white and blue.

    In any case, you just have to push the pixels left or right in the array to achieve that effect.

    Good luck, have fun!
     
  8. Seb Atkins

    Seb Atkins New Member

    Messages:
    6
    Hardware:
    RPi3
    @mvaladas Cheers for the reply, that's shedded some light on the subject

    Im going to have a play when i get back home tonight, I'll let you guys know how i get on,

    Cheers
     
  9. Seb Atkins

    Seb Atkins New Member

    Messages:
    6
    Hardware:
    RPi3
    @mvaladas This is where i am so far,

    i have used your french flag as a test along with some parts from the Knightrider effect, The whole matrix lights up all at once and then fades out and stays off, i cant seem to get the pixels scrolling across the matrix,

    Could you point out where i am going wrong and maybe point me in the right direction?

    Code:
    import hyperion
    import time
    import colorsys
    
    # Get the parameters
    speed = float(hyperion.args.get('speed', 1.0))
    fadeFactor = float(hyperion.args.get('fadeFactor', 0.7))
    
    
    # Check parameters
    speed = max(0.0001, speed)
    fadeFactor = max(0.0, min(fadeFactor, 1.0))
    
    # Initialize the led data
    width = 10
    imageData = bytearray()
    
    # french flag, width = 10
    # blue
    imageData += bytearray((int(0), int(85), int(164)))
    imageData += bytearray((int(0), int(85), int(164)))
    imageData += bytearray((int(0), int(85), int(164)))
    
    # white
    imageData += bytearray((int(255), int(255), int(255)))
    imageData += bytearray((int(255), int(255), int(255)))
    imageData += bytearray((int(255), int(255), int(255)))
    imageData += bytearray((int(255), int(255), int(255)))
    
    # red
    imageData += bytearray((int(239), int(65), int(53)))
    imageData += bytearray((int(239), int(65), int(53)))
    imageData += bytearray((int(239), int(65), int(53)))
    
    # Calculate the sleep time and rotation increment
    increment = 1
    sleepTime = 1.0 / (speed * width)
    while sleepTime < 0.05:
        increment *= 2
        sleepTime *= 2
    
    # Start the write data loop
    position = 0
    direction = 1
    while not hyperion.abort():
        hyperion.setImage(width, 1, imageData)
    
        # Move data into next state
        for i in range(increment):
            position += direction
            if position == -1:
                position = 1
                direction = 1
            elif position == width:
                position = width-2
                direction = -1
    
            # Fade the old data
            for j in range(width):
                imageData[3*j] = int(fadeFactor * imageData[3*j])
                imageData[3*j+1] = int(fadeFactor * imageData[3*j+1])
                imageData[3*j+2] = int(fadeFactor * imageData[3*j+2])
    
            # Insert new data
            imageData[3*position]
            imageData[3*position+1]
            imageData[3*position+2]
           
        # Sleep for a while
            time.sleep(sleepTime)