Skip to content

Commit 082aa84

Browse files
committed
hype gear example
1 parent 94a8aea commit 082aa84

3 files changed

Lines changed: 93 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Loading
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# encoding: utf-8
2+
load_library :hype
3+
include_package 'hype'
4+
java_import 'hype.extended.behavior.HRotate'
5+
attr_reader :box_x, :box_y, :box_z, :colors
6+
PALETTE = %w(#242424 #FF3300 #FF6600).freeze
7+
8+
def settings
9+
size(640, 640)
10+
end
11+
12+
def setup
13+
sketch_title 'HRotate Gears'
14+
H.init(self)
15+
@colors = web_to_color_array(PALETTE)
16+
H.background(colors[0])
17+
svg1 = HShape.new(data_path('cog_sm.svg'))
18+
svg2 = HShape.new(data_path('cog_lg.svg'))
19+
H.add(svg1).enableStyle(false).fill(colors[1]).anchorAt(H::CENTER).loc(223, 413)
20+
HRotate.new(svg1, -0.5)
21+
H.add(svg2).enableStyle(false).fill(colors[2]).anchorAt(H::CENTER).loc(690, 260)
22+
HRotate.new(svg2, 0.3333)
23+
end
24+
25+
def draw
26+
H.draw_stage
27+
end

0 commit comments

Comments
 (0)