@@ -166,6 +166,8 @@ addCanvas(2, (ctx, width, height, animate) => {
166
166
at either of the points.` ;
167
167
} ) ;
168
168
169
+ // TODO smooth closed shapes & sharp corners
170
+
169
171
addCanvas ( 2 , ( ctx , width , height , animate ) => {
170
172
const period = Math . PI * Math . E * 1000 ;
171
173
const start = point ( width * 0.3 , height * 0.8 , 0 , 0 , - 105 , width * 0.32 ) ;
@@ -256,21 +258,23 @@ addCanvas(
256
258
drawClosed ( ctx , shape , false ) ;
257
259
} ) ;
258
260
259
- return `Distribute blob points evenly around a center.` ;
261
+ return `Points are first distributed evenly around the center. At this stage the points
262
+ technically have handles, but since they have a length of zero, they have no effect on
263
+ the shape and it looks like a polygon.` ;
260
264
} ,
261
265
( ctx , width , height , animate ) => {
262
- const period = Math . PI * 1000 ;
266
+ const period = Math . PI * 1500 ;
263
267
const center : Coord = { x : width * 0.5 , y : height * 0.5 } ;
264
268
const radius = width * 0.3 ;
265
269
const points = 5 ;
266
- const randSeed = "abcd" ;
270
+ const randSeed = Math . random ( ) ;
267
271
const randStrength = 0.5 ;
268
272
269
273
const shape = makePoly ( points , radius , center ) ;
270
274
271
275
animate ( ( frameTime ) => {
272
276
const percentage = calcBouncePercentage ( period , timingFunctions . ease , frameTime ) ;
273
- const rgen = rand ( randSeed ) ;
277
+ const rgen = rand ( randSeed + Math . floor ( frameTime / period ) + "" ) ;
274
278
275
279
// Draw original shape.
276
280
tempStyles (
@@ -298,7 +302,9 @@ addCanvas(
298
302
drawClosed ( ctx , shiftedShape , true ) ;
299
303
} ) ;
300
304
301
- return `Move each point a random amount towards or away from the center.` ;
305
+ return `Points are then randomly moved further or closer to the center. Using a seeded
306
+ random number generator allows repeatable "randomness" whenever the blob is generated
307
+ at a different time or place.` ;
302
308
} ,
303
309
) ;
304
310
0 commit comments