Sha256: f3c7a8fde6d49c556516a65eb33a2495502f83bc0d79ca94cd19e9d25b42bf92

Contents?: true

Size: 639 Bytes

Versions: 4

Compression:

Stored size: 639 Bytes

Contents

# Rotate 1. 
# 
# Rotating simultaneously in the X and Y axis. 
# Transformation functions such as rotate() are additive.
# Successively calling rotate(1.0) and rotate(2.0)
# is equivalent to calling rotate(3.0). 

def setup    
    size 640, 360, P3D    
    @r_size = width / 6.0
    @a = 0.0    
    no_stroke
    fill 204, 204    
end

def draw    
  	background 0  	
  	@a += 0.005
  	@a = 0.0 if @a > TWO_PI  	
  	translate width/2, height/2  	
  	rotate_x @a
  	rotate_y @a * 2
  	rect -@r_size, -@r_size, @r_size*2, @r_size*2  	
  	rotate_x @a * 1.001
  	rotate_y @a * 2.002
  	rect -@r_size, -@r_size, @r_size*2, @r_size*2  	
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-processing-2.4.4 samples/processing_app/basics/transform/rotate1.rb
ruby-processing-2.4.3 samples/processing_app/basics/transform/rotate1.rb
ruby-processing-2.4.2 samples/processing_app/basics/transform/rotate1.rb
ruby-processing-2.4.1 samples/processing_app/basics/transform/rotate1.rb