1
1
require 'toxiclibs'
2
2
3
3
# <p>GrayScottImage uses the seedImage() method to use a bitmap as simulation seed.
4
- # In this demo the image is re-applied every frame and the user can adjust the
4
+ # In this demo the image is re-applied every frame and the user can adjust the
5
5
# F coefficient of the reaction diffusion to produce different patterns emerging
6
6
# from the boundary of the bitmapped seed. Unlike some other GS demos provided,
7
7
# this one also uses a wrapped simulation space, creating tiled patterns.</p>
8
8
#
9
9
# <p><strong>usage:</strong></p>
10
10
# <ul>
11
11
# <li>click + drag mouse to locally disturb the simulation</li>
12
- # <li>press 1-9 to adjust the F parameter of the simulation</li>
12
+ # <li>press 1-9 to adjust the F parameter of the simulation</li>
13
13
# <li>press any other key to reset</li>
14
14
# </ul>
15
15
#
16
16
17
- #
17
+ #
18
18
# Copyright (c) 2010 Karsten Schmidt
19
- #
19
+ #
20
20
# This demo & library is free software you can redistribute it and/or
21
21
# modify it under the terms of the GNU Lesser General Public
22
22
# License as published by the Free Software Foundation either
23
23
# version 2.1 of the License, or (at your option) any later version.
24
- #
24
+ #
25
25
# http:#creativecommons.org/licenses/LGPL/2.1/
26
- #
26
+ #
27
27
# This library is distributed in the hope that it will be useful,
28
28
# but WITHOUT ANY WARRANTY without even the implied warranty of
29
29
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
30
# Lesser General Public License for more details.
31
- #
31
+ #
32
32
# You should have received a copy of the GNU Lesser General Public
33
33
# License along with this library if not, write to the Free Software
34
34
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -47,7 +47,7 @@ def setup
47
47
48
48
def draw
49
49
@gs . seed_image ( img . pixels , img . width , img . height )
50
- @gs . set_rect ( mouse_x , mouse_y , 20 , 20 ) if mouse_pressed?
50
+ @gs . set_rect ( mouse_x , mouse_y , 20 , 20 ) if mouse_pressed?
51
51
load_pixels
52
52
10 . times { @gs . update ( 1 ) }
53
53
# read out the V result array
@@ -59,7 +59,7 @@ def draw
59
59
end
60
60
61
61
def key_pressed
62
- control_key = %w( 1 2 3 4 5 6 7 8 9 )
62
+ control_key = %w[ 1 2 3 4 5 6 7 8 9 ] . freeze
63
63
case key
64
64
when *control_key
65
65
@gs . setF ( 0.02 + ( key . ord - 48 ) * 0.001 )
@@ -74,4 +74,3 @@ def key_pressed
74
74
def settings
75
75
size ( 256 , 256 , P2D )
76
76
end
77
-
0 commit comments