Skip to content

benfordslaw/animated-hershey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

animatedHershey.js

Animated version of Lingdong's p5.hershey.js for p5.js

Online demo here

Basic usage

Before writing, reset timing variables and initialize the speed (ranging from 0 to 1)

P5.animatedHershey.reset([speed]);

General format for creating text

P5.animatedHershey.putText([animationStartTime], [textIsAnimated], [text], {
  cmap: [hersheyFontcmap],
  align: [alignment]
});

Immediately animate "Hello, world!" centered in the 'plain' hershey font

P5.animatedHershey.putText(millis(), true, "Hello, world!", {
  cmap: FONT_HERSHEY.PLAIN,
  align: "center"
});

Write "Hello, world!" as Lingdong's program would

P5.animatedHershey.putText(null, false, "Hello, world!", {
  cmap: FONT_HERSHEY.PLAIN,
  align: "center"
});