Skip to content

Commit

Permalink
[Rotate] add offset
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffshee committed Jun 7, 2019
1 parent 7cdcb7e commit a32be29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ class Rotate : Painter {
var xR: Float
var yR: Float
var rpm: Float
var offset: Float

constructor(painters: List<Painter>, xR: Float = .5f, yR: Float = .5f, rpm: Float = 1f) {
constructor(painters: List<Painter>, xR: Float = .5f, yR: Float = .5f, rpm: Float = 1f, offset: Float = 0f) {
this.painters = painters
this.xR = xR
this.yR = yR
this.rpm = rpm
this.offset = offset
}

constructor(painter: Painter, xR: Float = .5f, yR: Float = .5f, rpm: Float = 1f) : this(
listOf(painter), xR, yR, rpm
constructor(painter: Painter, xR: Float = .5f, yR: Float = .5f, rpm: Float = 1f, offset: Float = 0f) : this(
listOf(painter), xR, yR, rpm, offset
)

private var rot: Float = 0f

override fun draw(canvas: Canvas, helper: VisualizerHelper) {
rotateHelper(canvas, rot, xR, yR) {
rotateHelper(canvas, rot + offset, xR, yR) {
painters.forEach { painter ->
painter.draw(canvas, helper)
}
Expand Down

0 comments on commit a32be29

Please sign in to comment.