Sha256: 8acdeeae67507580e25aa812ae7df376dabb4d4bc840f099b4a9db494d909385
Contents?: true
Size: 909 Bytes
Versions: 1
Compression:
Stored size: 909 Bytes
Contents
# # ParticleSystemPShape # A particle system optimized for drawing using PShape # For guts of implementation see 'particle' library # load_libraries :vecmath, :particle # Particle System object and image attr_reader :ps def setup size(640, 360, P2D) # Load the image sprite = loadImage("sprite.png") # A new particle system with 10,000 particles @ps = ParticleSystem.new(width, height, sprite, 10000) # Writing to the depth buffer is disabled to avoid rendering # artifacts due to the fact that the particles are semi-transparent # but not z-sorted. hint(DISABLE_DEPTH_MASK) end def draw background(0) # Update and display system ps.update ps.display # Set the particle system's emitter location to the mouse ps.set_emitter(mouse_x, mouse_y) # Display frame rate fill(255, 0, 255) text_size(16) text("Frame rate: #{format('%.2f', frame_rate)}", 10, 20) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-processing-2.4.4 | samples/processing_app/topics/create_shapes/particle_system_pshape.rb |