these tutorials need to be built with expandsc before swfc'ing
[swftools.git] / doc / examples / PinsTutorial.sc
1 # Pins.sc
2 # tutorial on Pins for the user.
3
4 .swf bbox=autocrop version=4 fps=25 name="PinsTutorial.swf"
5
6 # SPRITES
7
8 .sprite reticle
9         .box box width=5 height=5 color=yellow
10         .put b1=box 0 0
11         .put b2=box 5 0
12         .put b3=box 0 5
13         .put b4=box 5 5
14 .end
15 #
16 # CHARACTERS
17 #
18 .circle pin 8 color=blue fill=blue
19 #
20 .font helv "HelveticaBold.swf"
21 #
22 .text mesg1 text="(1) This tutorial explains \"pins\" . . ." font=helv color=yellow size=25%
23 .text mesg2 text="(2) Every object such as this simple box ..." font=helv color=magenta size=25%
24 .text mesg3 text="(3) ... is \"pinned\" to a screen x,y." font=helv color=cyan size=25%
25 #
26 .text mesg4 text="(4) The yellow reticle is at 100,100..." font=helv color=red size=25%
27 .text mesg5 text="(5) The box's \"pin\" is at (relative to the box) 0,0." font=helv color=green size=25%
28 .text mesg6 text="(6) When we .put the box at 100,100, its pin lands..." font=helv color=blue size=25%
29 .text mesg7 text="(7) ... on 100,100." font=helv color=magenta size=25%
30 #
31 .text mesg8 text="(8) Relative 0,0 is the default pin." font=helv color=yellow size=25%
32 .text mesg9 text="(9) If we rotate the box..." font=helv color=red size=25%
33 .text mesg10 text="(10)... it rotates around its default pin" font=helv color=blue size=25%
34 .text mesg11 text="(11) If we specify a special pin called \"center\"" font=helv color=green size=25%
35 .text mesg12 text="(12) the box center will be at 100,100..." font=helv color=yellow size=25%
36 .text mesg13 text="(13) and it will rotate in place." font=helv color=cyan size=25%
37 #
38 .text mesg14 text="(14) Interesting things will happen if we rotate..." font=helv color=magenta size=25%
39 .text mesg15 text="(15) ... while a .change command moves the pin!" font=helv color=green size=25%
40 .text mesg16 text="(16) The pin is also relevant when scaling." font=helv color=blue size=25%
41 .text mesg17 text="(17) Scaling takes place relative to the fixed pin." font=helv color=red size=25%
42 .text mesg18 text="(18) It's important to know where your pin is!" font=helv color=white size=25%
43 # .text mesg19 text="(19) and it will rotate in place." font=helv color=red size=25%
44
45 # MACROS
46
47 # MAIN
48
49 .box box1 width=100 height=100 color=red line=5     # a simple red box
50     
51 .frame 0  
52         .macro tfader 0,10 mesg1
53         .put box1 x=100 y=100 alpha=0
54 .frame n+=20                            # *** slide 1
55         .change box1                    # hold that box
56 .frame n+=40
57         .change box1 alpha=100%         # box bright
58         .macro tfader 0,10 mesg2
59 .frame n+=40
60         .change box1                    # box hold
61 .frame n+=5
62         .jump box1 x=120 y=120          # why doesn't this work?
63 .frame n+=5
64         .jump box1 x=60 y=120           # why doesn't this work?
65 .frame n+=20
66         .macro tfader 0,10 mesg3
67         .jump box1                      # make the box appear suddenly and leap around a bit
68 .frame n+=5
69         .jump box1 x=100 y=100          # why doesn't this work?
70 .frame n+=5
71         .jump box1 x-=20
72 .frame n+=5
73         .jump box1 x-=20 y-=20
74 .frame n+=5
75         .jump box1 x=100 y=100          # put box bck where it belongs
76 .frame n+=5
77         .jump box1 x-=20 y-=15
78 .frame n+=5
79         .jump box1 x+=20 y+=40
80 .frame n+=5
81         .jump box1 x=100 y=100
82 .frame n+=5
83         .put pin 100 100 alpha=0 pin=center     # pin placed (dark, bottom layer)
84         .put reticle 100 100 alpha=0 pin=center # place reticle (dark, top layer)
85 .frame n+=20
86         .macro tfader 0,10 mesg4
87         .change box1 alpha=0            # box fade
88         .change reticle alpha=100%      # reticle bright
89 .frame n+=20
90         .change reticle                 # hold reticle
91 .frame n+=20
92         .change reticle alpha=0         # reticle dark
93         .change pin                     # hold that pin
94         .change box1                    # hold that box
95 .frame n+=20
96         .macro tfader 0,10 mesg5
97 .frame n+=20
98         .change box1 alpha=100%         # box bright
99 .frame n+=20
100         .change pin alpha=100%          # pin bright
101 .frame n+=20
102         .macro tfader 0,10 mesg6
103         .jump pin blue=0 red=+100%      # blink the pin!
104 .frame n+=5
105         .jump pin blue=100% red=0
106 .frame n+=5
107         .jump pin blue=0 red=+100%
108 .frame n+=5
109         .jump pin blue=100% red=0
110 .frame n+=5
111         .jump pin blue=0 red=+100%
112 .frame n+=5
113         .jump pin blue=100% red=0
114 .frame n+=5
115         .jump pin blue=0 red=+100%
116 .frame n+=5
117         .jump pin blue=100% red=0
118 .frame n+=5
119         .change reticle                 # hold that reticle!
120         .jump pin blue=0 red=+100%
121 .frame n+=5
122         .jump pin blue=100% red=0
123 .frame n+=15
124         .macro tfader 0,10 mesg7
125         .change reticle alpha=100%
126 .frame n+=60
127         .macro tfader 0,10 mesg8
128 .frame n+=20
129         .change box1
130 .frame n+=20
131         .macro tfader 0,10 mesg9
132 .frame n+=20
133         .change box1 rotate+=90
134 .frame n+=40
135         .macro tfader 0,10 mesg10
136 .frame n+=1
137         .change box1 rotate-=90
138         .change pin
139 .frame n+=59
140         .macro tfader 0,10 mesg11
141         .change box1
142 .frame n+=20
143         .change box1 x=100 y=100 pin=center
144 .frame n+=5
145         .jump pin blue=100% red=0
146 .frame n+=15
147         .jump pin blue=0 red=+100%
148 .frame n+=15
149         .jump pin blue=100% red=0
150 .frame n+=5
151         .macro tfader 0,10 mesg12
152         .jump pin blue=0 red=+100%
153 .frame n+=5
154         .jump pin blue=100% red=0
155 .frame n+=5
156         .jump pin blue=0 red=+100%
157 .frame n+=5
158         .jump pin blue=100% red=0       
159 .frame n+=5
160         .change box1
161 .frame n+=20
162         .macro tfader 0,10 mesg13
163         .change box1 rotate+=90 pin=center
164 .frame n+=40
165         .change box1 rotate-=90
166 .frame n+=20
167         .macro tfader 0,10 mesg14
168         .change box1 pin=(0,0) x=100 y=100
169 .frame n+=60
170         .macro tfader 0,10 mesg15
171         .change box1 pin=center rotate+=90
172 .frame n+=60
173         .change box1 pin=(0,0) rotate-=90
174         .macro tfader 0,10 mesg16
175 .frame n+=40
176         .change box1 scale=50%
177 .frame n+=40
178         .change box1 scale=100%
179 .frame n+=15 
180         .change box1 pin=center
181 .frame n+=5
182         .macro tfader 0,10 mesg17
183 .frame n+=40
184         .change box1 scale=50%
185 .frame n+=40
186         .change box1 scale=100% alpha=0
187 .frame n+=5
188         .macro tfader 0,10 mesg18
189         .jump pin blue=0 red=+100%
190 .frame n+=5
191         .jump pin blue=100% red=0
192 .frame n+=5
193         .jump pin blue=0 red=+100%
194 .frame n+=5
195         .jump pin blue=100% red=0
196 .frame n+=20
197         .change pin alpha=0
198
199 .end
200
201