Start a new topic

Remove GeoObjects with Animations


I'm using iOS Javascript API.

I have created a particle animation using GeoObjects. I want to stop animation(remove all particles) on a user action. I did it, but it takes considerable time to remove all particles. I want to just remove(or hide) all particles on user action. Please help me overcome this problem.

This is my code:

// start animation

function  showParticlesAnimation() {

for (var i = 0; i < 600; i++) {

     var model = new AR.Model("assets/particle_1.wt3", {scale: { x: scaleX, y: scaleY, z: scaleZ }});

     var rotX = new AR.PropertyAnimation(model, "rotate.y", -25, 335, 3000);

     var rotY = new AR.PropertyAnimation(model, "rotate.x", -25, 335, 3000);

     var rotZ = new AR.PropertyAnimation(model, "rotate.z", -25, 335, 3000);

     var rotArray = [rotX, rotY, rotZ];

     var animGroupRotate = new AR.AnimationGroup(AR.CONST.ANIMATION_GROUP_TYPE.PARALLEL, rotArray);


    var easingCurve = new AR.EasingCurve(AR.CONST.EASING_CURVE_TYPE.EASE_OUT_SINE);

    transX = new AR.PropertyAnimation(model, "translate.x", 0, x, animTime, easingCurve);

    transY = new AR.PropertyAnimation(model, "translate.y", 0, y, animTime, easingCurve);

    transZ = new AR.PropertyAnimation(model, "translate.z", 0, z, animTime, easingCurve);

    var animGroupTraslate = new AR.AnimationGroup(AR.CONST.ANIMATION_GROUP_TYPE.PARALLEL, [transX, transY, transZ]);


   var pLocation = new AR.RelativeLocation(null, startN, startE, startY);

    var obj = new AR.GeoObject(pLocation, {

      drawables: {

        cam: [model]



    // snowParticles is array to keep GeoObjects






function  hideAnimation() {

    for (var i = 0; i < World.snowParticles.length; i++) {

    // stopping corresponding animations

    var j = 2*i;

    if (j + 1 < World.snowAnimations.length) {

     var rotAnimation = World.snowAnimations[j];


     var trAnimation = World.snowAnimations[j+1];



    // removing ARObjects

    var snowParticle = World.snowParticles[i];

    var locations = snowParticle.locations;

    var drawables =;

    for (var l = 0; l < locations.length; l++) {



    for (var d = 0; d < drawables.length; d++) {



    snowParticle.enabled = false;



   World.snowAnimations = [];

   World.snowParticles = [];


1 person has this problem

Good morning,

creating 600 individual particle models is very inefficient. This will result in 600 individual draw calls for your particle system. Correspondingly, you will have 600 calls for every manipulation, be it starting, stopping, destroying etc. Considering that every manipulation also includes a calls from JavaScript to C++, this is bound to take some time.

I'd recommend using a single model containing all the particles with an animation instead if that is possible for your use-case.

Having said that, you could try to set the enabled property of the AR.Model to false instead of destroying them when hiding your particle system. You also don't necessarily need to stop the animation. This would, again, save some JavaScript to C++ calls.

- Daniel

你好   请问您将动画开始对额代码放在了什么地方呢?可以指导我一下么?

Good morning,

my apologies, but I do not speak Chinese. Google Translate didn't give me anything intelligible either. Would you mind posting your question again in English?

- Daniel

Hello, I import a wt3 format 3D model to my extend tracking project, but can not play its animation effect, what do I need to do?

If you open your wt3 model in Wikitude3dEncoder you may be abele to see animations of you model in the right animation pane.

then you can use animation names to crate animations in the AR World.

var ballAnimation = new AR.ModelAnimation(modelBall, "MirrorBall_animation");// animation name is from 3D design (can find from W-Studio)


Original link is here  open the link and search "ModelAnimation" in the page

Login or Signup to post a comment