I'm making a Patatap clone, and trying to make different shapes and different animations on each key.
I've figured how to assign different shapes on onKeyDown
function, but I'm stuck at onFrame
function to give different animations on each shape.
I tried to check the array of shapes to find out the difference, but since it has tons of lines, I was not able to.
//Just short dummy code to roughly show how I did
function onKeyDown(event){
if(type === 'rectangle'){
var shape = new Path.Rectangle
}else if(type === 'circle'){
var shape = new Path.Circle
}
}
... this works
function onFrame(event){
shape.fillColor.hue += 1; //this works
//I want to do this
//shape.type is just a made up variable
if(shape.type === 'rectangle'){
shape.rotate(5);
}else if(shape.type === 'circle'){
shape.scale(0.95);
}
Thanks for any help
You can use the Path.data
property to add things you need for your logic, I updated your nice demo by adding a name
property giving the type of the shape.