Ejemplo n.º 1
0
                              particlesperframe=1)
        source.CreateKeyframe(source.curframe + 2,
                              pos=(x, y),
                              particlesperframe=0)


# screen = pygame.display.set_mode((800, 600))
# screen = cv.CreateImage((800,600), 8, 3)
screen = np.zeros((600, 800, 3), np.uint8)
# pygame.display.set_caption("PyIgnition demo: bubbles")
windowname = "Particles Demo: Bubbles"
cv2.namedWindow(windowname)
cv2.setMouseCallback(windowname, on_mouse)
# clock = pygame.time.Clock()

effect = part.ParticleEffect(screen, (0, 0), (800, 600))
source = effect.CreateSource(initspeed=1.0,
                             initdirection=0.0,
                             initspeedrandrange=0.5,
                             initdirectionrandrange=math.pi,
                             particlelife=1000,
                             colour=(200, 255, 200),
                             drawtype=DRAWTYPE_BUBBLE,
                             radius=4.0)
source.CreateParticleKeyframe(500, colour=(250, 100, 250))
source.CreateParticleKeyframe(75, colour=(190, 190, 200))
source.CreateParticleKeyframe(100, colour=(50, 250, 252))
source.CreateParticleKeyframe(125, colour=(250, 250, 255))
effect.CreateDirectedGravity(strength=0.04, direction=[0, -1])

while True:
Ejemplo n.º 2
0
windowname = 'OpenCV2 & particlescv2'
screen = np.zeros((600, 800, 3), np.uint8)
cv2.imshow(windowname, screen)
# pygame.display.set_caption("PyIgnition 'Controlled Eruption' demo")
#clock = pygame.time.Clock()

curframe = 0
started = False

# 'Press space to start' text
#starttextfont = pygame.font.Font("courbd.ttf", 50)
#starttext = starttextfont.render("Press space to start", True, (255, 255, 255), (0, 0, 0))
#starttextpos = ((400 - (starttext.get_width() / 2)), (300 - (starttext.get_height() / 2)))

# Background
background = parts.ParticleEffect(screen, (0, 0), (800, 600))
backgroundsource = background.CreateSource((10, 10),
                                           initspeed=5.0,
                                           initdirection=2.35619449,
                                           initspeedrandrange=2.0,
                                           initdirectionrandrange=1.0,
                                           particlesperframe=5,
                                           particlelife=125,
                                           drawtype=DRAWTYPE_SCALELINE,
                                           colour=(255, 255, 255),
                                           length=10.0)
backgroundsource.CreateParticleKeyframe(50, colour=(0, 255, 0), length=10.0)
backgroundsource.CreateParticleKeyframe(75, colour=(255, 255, 0), length=10.0)
backgroundsource.CreateParticleKeyframe(100, colour=(0, 255, 255), length=10.0)
backgroundsource.CreateParticleKeyframe(125, colour=(0, 0, 0), length=10.0)
backgroundsource2 = background.CreateSource((790, 10),
Ejemplo n.º 3
0
DRAWTYPE_POINT = 0
DRAWTYPE_CIRCLE = 1
DRAWTYPE_LINE = 2
DRAWTYPE_SCALELINE = 3
DRAWTYPE_BUBBLE = 4
DRAWTYPE_IMAGE = 5

# screen = pygame.display.set_mode((600, 600))
# screen = cv.CreateImage((800,600), 8, 3)
screen = np.zeros((600, 800, 3), np.uint8)
# pygame.display.set_caption("PyIgnition demo: catherine wheel")
# clock = pygame.time.Clock()
windowname = "PyIgnition demo: catherine wheel"
cv2.namedWindow(windowname)

wheel = part.ParticleEffect(screen, (0, 0), (600, 600))
#image = pygame.image.load("Spark.png").convert_alpha()
spark = cv2.imread("Spark.png")
# spark = np.zeros((5, 5, 3), np.uint8)
# spark = cv.CreateImage((5,5), 8, 3)
spark = cv2.resize(spark, (5,5))
image = spark
flame = wheel.CreateSource((300, 300), initspeed = 20.0, initdirection = 0.0, initspeedrandrange = 0.0, initdirectionrandrange = 0.5, particlesperframe = 3, particlelife = 50, drawtype = DRAWTYPE_SCALELINE, colour = (255, 200, 200), length = 20.0)
sparks = wheel.CreateSource((300, 300), initspeed = 1.0, initdirection = 0.0, initspeedrandrange = 0.9, initdirectionrandrange = 3.141592653, particlesperframe = 1, particlelife = 300, genspacing = 3, drawtype = DRAWTYPE_IMAGE, image = image)
wheel.CreateDirectedGravity(strength = 0.05, direction = [0, 1])

velocity = 0.1
maxvelocity = 0.5
acceleration = 0.001