Sha256: 85ce98e02a96ed035299d0bb9d1bfd8ba155476146858a897769e996ba131cbe

Contents?: true

Size: 566 Bytes

Versions: 6

Compression:

Stored size: 566 Bytes

Contents

# Sine. 
# 
# Smoothly scaling size with the sin() function.


def setup    
  size 640, 360
  no_stroke
  @diameter = 84.0
  @sin = 0.0
  @angle = 0.0
  @rad_points = 90
  
end

def draw  
  background 153  	
  translate width / 2, height / 2  	
  fill 255
  ellipse 0, 0, 16, 16  	
  angle_rot = 0.0
  fill 51  	
  (0...5).each { |i|
    
    push_matrix
    rotate angle_rot - 45
    ellipse(-116, 0, @diameter, @diameter)
    pop_matrix
    angle_rot += TAU/5
  }  	
  @diameter = 34 * sin( @angle ) + 168
  @angle += 0.02
  #@angle = 0.0 if @angle > TAU  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/math/sine.rb
ruby-processing-2.6.2 samples/processing_app/basics/math/sine.rb
ruby-processing-2.6.1 samples/processing_app/basics/math/sine.rb
ruby-processing-2.6.0 samples/processing_app/basics/math/sine.rb
ruby-processing-2.5.1 samples/processing_app/basics/math/sine.rb
ruby-processing-2.5.0 samples/processing_app/basics/math/sine.rb