package Ragedemo01;

import processing.core.*;

public class RageBowties extends PApplet {
	
	private PApplet parent;
	private PImage img;
	private float xpos;
	private float ypos;
	private float xmov;
	private float ymov;
	private float rotInput;
	private float rotAffector;
	private float rotAffectorInput;
	
	RageBowties(PApplet p, float xpos, float ypos, float xmov, float ymov) {
		
		this.parent = p;
		this.img = p.loadImage("bowtie.png");
		this.xpos = xpos;
		this.ypos = ypos;
		this.xmov = xmov;
		this.ymov = ymov;
		this.rotAffectorInput = parent.random(0f, 10f);
		
	}
	
	public void draw() {
		
		rotAffectorInput += 0.05f;
		
		rotAffector = (float) Math.sin(rotAffectorInput);
		
		parent.pushMatrix();
		
		parent.rotate((float) (PI/3.0 * rotAffector));
		
		xpos += xmov;
		ypos += ymov;
		
		parent.image(img, xpos, ypos);
		
		parent.popMatrix();
		
	}

}
