What action is best effect for earthquake

What action is best effect for earthquake
0

hi guys. now i create screen effect earthquake
and i used action to background’s node => bgNode.runAction(cc.jumpTo(duration, 0, 0, gap, shakeCount).easing(cc.ease~~()));

i tried to various “easing”, and change the value(duration, gap, shakecount) .

but it’s not look so earthquake. it’s… something is wrong!
feel so different.

so anyone have good idea?

ps) i’ve tried to “moveTo” And runAction(sequence(actionA,actionB …)) but i want to simple it

You can use cc.sequence of cc.spawn that has multiple actions in it. Like this:

cc.Class({
extends: cc.Component,

properties: {

},


getRandom: function(min, max) {
return Math.random() * (max - min) + min;

},

start () {
	let movement = 5;
	let scale = 10;

	let startingPos = this.node.position;
	let startingScale = this.node.scaleY;

	this.node.runAction(
		cc.sequence(
			cc.spawn(
				cc.moveBy(0.1,this.getRandom(-movement, movement),this.getRandom(-movement, movement)), 
				cc.scaleBy(0.1,this.getRandom(-scale, scale))
			),
			cc.spawn(
				cc.moveBy(0.1,this.getRandom(-movement, movement),this.getRandom(-movement, movement)), 
				cc.scaleBy(0.1,this.getRandom(-scale, scale))
			),
			//...

			// Reset
 			cc.spawn(
				cc.moveTo(0.1, startingPos), 
				cc.scaleTo(0.1,startingScale)
			),

		)
	);
},

});

Set script to camera, and modify the actions to create better effect, as I made this as an example in 3 min :slight_smile: , but taht is the general idea, hope it helps.