Sha256: 1b59726abd32476627ad3c916a4083d47a90d3705a84eae001b052e53ac805c8
Contents?: true
Size: 778 Bytes
Versions: 12
Compression:
Stored size: 778 Bytes
Contents
require 'green_shoes' Shoes.app title: 'A Tiny Chipmunk Physics Demo' do extend ChipMunk space = cp_space balls = [] nofill cp_line 0, 180, 200, 280, stroke: gold cp_line 200, 280, 300, 270, stroke: gold cp_line 250, 350, 350, 330 cp_line 170, 370, 220, 380 cp_line 100, 450, 300, 430, stroke: lightslategray cp_line 300, 430, 500, 450, stroke: lightslategray nostroke oval(10, 30, 40, 40, fill: blue).click{balls << cp_oval(30, 50, 20, stroke: blue, strokewidth: 2)} oval(70, 40, 20, 20, fill: green).click{balls << cp_oval(80, 50, 10, fill: green)} oval(105, 45, 10, 10, fill: red).click{balls << cp_oval(110, 50, 5, fill: red)} animate do 6.times{space.step 1.0/60} balls.each{|ball| ball.cp_move} end end
Version data entries
12 entries across 12 versions & 1 rubygems