-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCircular wave effect in 2 sizes.rb
57 lines (43 loc) · 1.23 KB
/
Circular wave effect in 2 sizes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Default code, use or delete...
@mod = Sketchup.active_model # Open model
@ent = @mod.entities # All entities in model
@sel = @mod.selection # Current selection
@view = @mod.active_view
@dizi = Array.new(10) {Array.new(10)}
@s = 100.inch
@w = 60.inch
@beta = 0.01
def build_material()
n = 10
(0..n-1).each { |i|
(0..n-1).each { |j|
pts = []
pts[0] = [i*@s,j*@s,0]
pts[1] = [i*@s,j*@s+@w,0]
pts[2] = [i*@s+@w,j*@s+@w,0]
pts[3] = [i*@s+@w,j*@s,0]
entities2 = @ent.add_group
face = entities2.entities.add_face pts
face.back_material = [200,(255/(n)*j).round,(255/(n)*i).round]
face.pushpull -40
@dizi[i][j]=entities2
}
}
end
def scale_object()
(0..45).each { |k|
(0..9).each { |i|
(0..9).each { |j|
height = Math.cos(@beta*(((i)*(i+k))+((j)*(j+k))))*1.7
scale_transformation = Geom::Transformation.scaling(1,1,height)
@dizi[j][i].transformation =scale_transformation
@dizi[j][i].transform!(scale_transformation)
}
# $view.refresh
}
sleep 0.08
@view.refresh
}
end
build_material()
scale_object()