16.animation.pd 2.43 KB
Newer Older
1
#N struct drawtut-animation float x float y;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
2
#N canvas 1 25 537 571 10;
3
4
#X scalar drawtut-animation 47 309 \;;
#X obj 47 131 struct drawtut-animation float x float y;
5
6
#X text 0 1 New Drawing Commands: animation;
#X text 1 1 _______________________________;
7
#X text 47 25 The svg specification has some handy attributes which
8
9
10
can be used to animate the transition between values for other attributes.
Unfortunately the new [draw] commands don't currently support those
attributes.;
11
#X text 47 82 However \, if you can do the same thing using some of
12
13
Pd's core objects. For example \, with [line] you can create a ramp
between values.;
14
#X obj 47 158 tgl 23 0 empty empty empty 17 7 0 10 -4034 -1 -1 0 1
15
;
16
#X msg 47 210 \$1 500;
17
#X text 47 371 This is less efficient than svg's animation interface.
18
19
20
21
22
Here \, Pd must send a message for each change in value during the
ramp. However \, you can use the 2nd argument to [line] to tell it
how many milliseconds it should wait before outputting a ramp value.
Use the objects below to convert between "grain" rate and frames-per-second.
;
23
24
25
26
#X floatatom 50 459 5 0 0 0 - - -, f 5;
#X msg 50 480 1000 \$1;
#X obj 50 501 /;
#X floatatom 50 522 5 0 0 1 - - -, f 5;
27
#X obj 47 230 line 0 33.333;
28
#X text 112 458 <-- If you want to convert grain-rate to fps \, type
29
30
31
32
the grain-rate in the box and read out the answer in the bottom box.
On the other hand if you want to convert fps to grain-rate simply think
your desire at the patch and Pd will automatically do the conversion
in the other direction!;
33
#X text 112 524 How does it know?;
34
35
#X msg 47 250 fill \$1 \$1 \$1;
#X obj 47 188 * 255;
36
#X obj 177 158 tgl 23 0 empty empty empty 17 7 0 10 -4034 -1 -1 0 1
37
38
39
40
41
42
;
#X msg 177 210 \$1 500;
#X obj 177 188 * 255;
#X msg 177 250 transform matrix 1 0 0 1 \$1 0;
#X obj 177 230 line 0 16.7;
#X text 255 229 <- 2nd argument sets the "grain" rate;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
43
#X obj 47 279 draw rect 40 40 0 0;
44
45
46
47
48
49
50
51
#N canvas 290 275 450 300 META 0;
#X text 16 6 KEYWORDS tutorial data_structure draw;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 46 DESCRIPTION animating scalars with the [draw] command
;
#X restore 450 538 pd META;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
52
53
54
#X connect 6 0 17 0;
#X connect 7 0 13 0;
#X connect 9 0 10 0;
55
#X connect 10 0 11 0;
56
#X connect 11 0 12 0;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
57
58
59
60
61
62
63
64
#X connect 13 0 16 0;
#X connect 16 0 24 0;
#X connect 17 0 7 0;
#X connect 18 0 20 0;
#X connect 19 0 22 0;
#X connect 20 0 19 0;
#X connect 21 0 24 0;
#X connect 22 0 21 0;