コード例 #1
0
 def __init__(self, level, rectTuple, image=None):
     super(Player, self).__init__(level, rectTuple, image)
     try:
         self.runAnim = anim.Animation("lib\\player.png", self.rect.width, self.animation_speed)
         self.crouchAnim = anim.Animation("lib\\crouching.png", self.rect.width, 0.07)
         self.idle = anim.Animation("lib\\idle.png", self.rect.width, 0)
         self.idleCrouching = anim.Animation("lib\\idle_crouching.png", self.rect.width, 0)
         self.hasAnim = True
     except pygame.error:
         self.hasAnim = False
     self.defMaxSpeed = self.maxSpeed
コード例 #2
0
ファイル: asciiart.py プロジェクト: wushiwang/Depths-of-Mars
def load(fName, pxSz=1):
    colors = {
        'W': (255, 255, 255),
        'w': (128, 128, 128),
        'R': (255, 0, 0),
        'r': (128, 0, 0),
        'G': (0, 255, 0),
        'g': (0, 128, 0),
        'B': (0, 0, 255),
        'b': (0, 0, 128)
    }
    out = {}
    oName = ''
    buff = []
    duration = 1
    f = open(fName, 'r')
    lnNo = 0
    for ln in f:
        lnNo += 1
        if ln.startswith('#'):
            continue
        ln = ln.rstrip()
        if ln == '':
            if buff and oName:
                out[oName].append(makeImg(buff, colors, pxSz), duration)
                buff = []
            continue
        if ln.startswith('@'):
            if ln.startswith('@duration'):
                duration = int(ln[9:].strip())
            elif ln.startswith('@name'):
                oName = ln[5:].strip()
                out[oName] = anim.Animation()
            elif ln.startswith('@end') and oName:
                out[oName].cycle = False
            elif ln.startswith('@color'):
                (ch, r, g, b) = ln[6:].strip().split(' ')
                colors[ch] = (int(r), int(g), int(b))
            else:
                raise "Wrong directive '%s' on line %d, name '%s'"\
                        %(ln, lnNo, oName)
            continue
        #endif
        buff.append(ln.strip("'"))
    #endfor
    if buff and oName:
        out[oName].append(makeImg(buff), duration)

    return out
コード例 #3
0
ファイル: anim_test.py プロジェクト: SMLMS/ALEX
# Company: Goethe University of Frankfurt
# Institute: Institute of Physical and Theoretical Chemistry
# Department: Single Molecule Biophysics
# License: GPL3
#####################################################################'''
import numpy as np
import anim
from multiprocessing import Queue as mpQueue
import time


duration = 10
signal = None


def gen_data(duration):
    for i in np.arange(duration):
        time.sleep(0.1)
        a = np.arange(1000)
        q1.put(a)
        q2.put(a)

q1 = mpQueue()
q2 = mpQueue()
anim = anim.Animation(q1, q2, duration, 1000)

anim.run()
gen_data(duration)
anim.animate()
anim.anim._stop()
コード例 #4
0
ファイル: trailer.py プロジェクト: c-base/c_leuse
def start_words2():
    anim.Animation(Player.getElementByID("meets_future"), "opacity", 1.0, 0.0,
                   2000)
コード例 #5
0
ファイル: trailer.py プロジェクト: c-base/c_leuse
def start_words1():
    anim.Animation(Player.getElementByID("moon"), "opacity", 0.0, 1.0, 1000)
    anim.Animation(Player.getElementByID("where_past"), "opacity", 1.0, 0.0,
                   2000)
コード例 #6
0
ファイル: trailer.py プロジェクト: c-base/c_leuse
def start_logo():
    Player.getElementByID("c-wars").opacity = 1
    anim.fadeOut(Player.getElementByID("c-wars"), 3000)
    anim.Animation(Player.getElementByID("c-wars"), "x", 66, 40, 5000)