Skip to content

Keeps track of translate, rotate, scale, push and pop in p5 and Javascript

Notifications You must be signed in to change notification settings

ChristerNilsson/Transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transformer

Keeps track of translate, rotate, scale, push and pop in p5 and Javascript

Usage:

tf = new Transformer()

Prefix all calls to the following functions with tf.

  • translate()
  • rotate()
  • scale()
  • push()
  • pop()

To find out the current canvas coordinates just use tf.x and tf.y in the draw() function. tf.a gives the current rotation and tf.s gives the current scale.

This information is of special interest in combination with mouseX and mouseY as these are expressed in canvas coordinates.

Link to HTML Canvas object: http://www.w3schools.com/tags/ref_canvas.asp

About

Keeps track of translate, rotate, scale, push and pop in p5 and Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published