Sha256: 1b73bba142442387a12c271664a90d95ef701e29b55aa5328860bacb1dec0c0a

Contents?: true

Size: 636 Bytes

Versions: 6

Compression:

Stored size: 636 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 > TAU  	
  	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

6 entries across 6 versions & 1 rubygems

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