textmode.js 0.9.0-beta.1 → 0.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -74,12 +74,24 @@ export declare class AnimationController {
|
|
|
74
74
|
* Get the number of milliseconds since the animation started.
|
|
75
75
|
* Returns 0 if the animation has not started yet.
|
|
76
76
|
*/
|
|
77
|
-
$millis(): number;
|
|
77
|
+
get $millis(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Set the elapsed milliseconds by adjusting the start time.
|
|
80
|
+
* This allows seeking/scrubbing in animations.
|
|
81
|
+
* @param value The new elapsed time in milliseconds
|
|
82
|
+
*/
|
|
83
|
+
set $millis(value: number);
|
|
78
84
|
/**
|
|
79
85
|
* Get the number of seconds since the animation started.
|
|
80
86
|
* Returns 0 if the animation has not started yet.
|
|
81
87
|
*/
|
|
82
|
-
$secs(): number;
|
|
88
|
+
get $secs(): number;
|
|
89
|
+
/**
|
|
90
|
+
* Set the elapsed seconds by adjusting the start time.
|
|
91
|
+
* This allows seeking/scrubbing in animations.
|
|
92
|
+
* @param value The new elapsed time in seconds
|
|
93
|
+
*/
|
|
94
|
+
set $secs(value: number);
|
|
83
95
|
/**
|
|
84
96
|
* Get the time in milliseconds between the current frame and the last frame.
|
|
85
97
|
* Useful for frame-rate-independent animations.
|
|
@@ -96,6 +96,7 @@ export declare class Textmodifier extends Textmodifier_base implements ITextmodi
|
|
|
96
96
|
get layers(): LayerManager;
|
|
97
97
|
get filters(): TextmodeFilterManager;
|
|
98
98
|
get conversions(): TextmodeConversionManager;
|
|
99
|
+
get isRenderingFrame(): boolean;
|
|
99
100
|
}
|
|
100
101
|
export interface Textmodifier extends IRenderingMixin, IAnimationMixin, IMouseMixin, ITouchMixin, IKeyboardMixin {
|
|
101
102
|
}
|
|
@@ -24,14 +24,16 @@ export interface IAnimationMixin {
|
|
|
24
24
|
*/
|
|
25
25
|
frameRate(fps?: number): number | void;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Get the number of milliseconds since the sketch started running.
|
|
28
28
|
*
|
|
29
|
-
* `millis
|
|
29
|
+
* `millis` keeps track of how long a sketch has been running in milliseconds
|
|
30
30
|
* (thousandths of a second). This information is often helpful for timing events
|
|
31
31
|
* and animations.
|
|
32
32
|
*
|
|
33
33
|
* Time tracking begins before the code in {@link setup} runs. If loading screen is
|
|
34
|
-
* enabled, `millis
|
|
34
|
+
* enabled, `millis` begins tracking as soon as the loading screen starts.
|
|
35
|
+
*
|
|
36
|
+
* This property is connected to {@link secs} - setting one will affect the other.
|
|
35
37
|
*
|
|
36
38
|
* @returns Number of milliseconds since starting the sketch.
|
|
37
39
|
*
|
|
@@ -43,7 +45,7 @@ export interface IAnimationMixin {
|
|
|
43
45
|
* t.background(0);
|
|
44
46
|
*
|
|
45
47
|
* // Get the number of seconds the sketch has run
|
|
46
|
-
* const seconds = t.millis
|
|
48
|
+
* const seconds = t.millis / 1000;
|
|
47
49
|
*
|
|
48
50
|
* t.text(`Running time: ${seconds.toFixed(1)} sec`, 10, 10);
|
|
49
51
|
* });
|
|
@@ -56,23 +58,42 @@ export interface IAnimationMixin {
|
|
|
56
58
|
* t.draw(() => {
|
|
57
59
|
* t.background(0);
|
|
58
60
|
*
|
|
59
|
-
* // Use millis
|
|
60
|
-
* const time = t.millis
|
|
61
|
+
* // Use millis for smooth animation
|
|
62
|
+
* const time = t.millis / 1000;
|
|
61
63
|
* const x = Math.sin(time) * 20 + 40;
|
|
62
64
|
*
|
|
63
65
|
* t.char('O', Math.floor(x), 10);
|
|
64
66
|
* });
|
|
65
67
|
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```javascript
|
|
71
|
+
* const t = textmode.create({ width: 800, height: 600 });
|
|
72
|
+
*
|
|
73
|
+
* // Seek to a specific time in the animation
|
|
74
|
+
* t.millis = 5000; // Jump to 5 seconds
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
get millis(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Set the elapsed milliseconds by adjusting the internal start time.
|
|
80
|
+
*
|
|
81
|
+
* This allows seeking/scrubbing in animations. Setting `millis` will also
|
|
82
|
+
* affect the value returned by {@link secs} since they are connected.
|
|
83
|
+
*
|
|
84
|
+
* @param value The new elapsed time in milliseconds
|
|
66
85
|
*/
|
|
67
|
-
millis(
|
|
86
|
+
set millis(value: number);
|
|
68
87
|
/**
|
|
69
|
-
*
|
|
88
|
+
* Get the number of seconds since the sketch started running.
|
|
70
89
|
*
|
|
71
|
-
* `secs
|
|
72
|
-
* instead of milliseconds. Equivalent to `millis
|
|
90
|
+
* `secs` is a convenience property that returns the elapsed time in seconds
|
|
91
|
+
* instead of milliseconds. Equivalent to `millis / 1000`.
|
|
73
92
|
*
|
|
74
93
|
* Time tracking begins before the code in {@link setup} runs. If loading screen is
|
|
75
|
-
* enabled, `secs
|
|
94
|
+
* enabled, `secs` begins tracking as soon as the loading screen starts.
|
|
95
|
+
*
|
|
96
|
+
* This property is connected to {@link millis} - setting one will affect the other.
|
|
76
97
|
*
|
|
77
98
|
* @returns Number of seconds since starting the sketch.
|
|
78
99
|
*
|
|
@@ -83,15 +104,32 @@ export interface IAnimationMixin {
|
|
|
83
104
|
* t.draw(() => {
|
|
84
105
|
* t.background(0);
|
|
85
106
|
*
|
|
86
|
-
* // Use secs
|
|
87
|
-
* const angle = t.secs
|
|
107
|
+
* // Use secs for smooth time-based animations
|
|
108
|
+
* const angle = t.secs * Math.PI;
|
|
88
109
|
* const x = Math.sin(angle) * 10;
|
|
89
110
|
*
|
|
90
111
|
* t.text(`X: ${x.toFixed(2)}`, 10, 10);
|
|
91
112
|
* });
|
|
92
113
|
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```javascript
|
|
117
|
+
* const t = textmode.create({ width: 800, height: 600 });
|
|
118
|
+
*
|
|
119
|
+
* // Seek to a specific time in the animation
|
|
120
|
+
* t.secs = 10; // Jump to 10 seconds (equivalent to t.millis = 10000)
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
get secs(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Set the elapsed seconds by adjusting the internal start time.
|
|
126
|
+
*
|
|
127
|
+
* This allows seeking/scrubbing in animations. Setting `secs` will also
|
|
128
|
+
* affect the value returned by {@link millis} since they are connected.
|
|
129
|
+
*
|
|
130
|
+
* @param value The new elapsed time in seconds
|
|
93
131
|
*/
|
|
94
|
-
secs(
|
|
132
|
+
set secs(value: number);
|
|
95
133
|
/**
|
|
96
134
|
* Returns the time in milliseconds between the current frame and the previous frame.
|
|
97
135
|
*
|
package/package.json
CHANGED