# New camera position with the animation (transition) to the click of a button

**URL:** <https://forum.babylonjs.com/t/new-camera-position-with-the-animation-transition-to-the-click-of-a-button/561>\
**Category:** Questions\
**Created:** [January 4, 2019, 1:57pm UTC](https://forum.babylonjs.com/t/new-camera-position-with-the-animation-transition-to-the-click-of-a-button/561 "2019-01-04T13:57:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 4, 2019, 3:06pm UTC](https://forum.babylonjs.com/t/new-camera-position-with-the-animation-transition-to-the-click-of-a-button/561/2 "2019-01-04T15:06:56Z")

</div>

Hi AA!

[https://playground.babylonjs.com/#AJADK6#10](https://playground.babylonjs.com/#AJADK6#10)

Let’s see. Line 72 needed to be a property name-string. You had it set as a vector3 in quotes.

Line 74 - changed to vector3 type. You had it set vector2.

Line 75 - set to loopmode CONSTANT… just because I like it to hold position at end of animation. NOTE: The animation is still STARTed when it ends… so activating an animation.stop() in the callback function… might be wise. There MIGHT BE a .disposeOnEnd or .stopOnEnd Boolean property on animations. Not sure.

Line 82 - camera.position.clone() for beginning animation position.

Line 83 & 93 disabled… because I don’t know what they do… yet. 🙂

Line 86… added a “middle frame”… just because the animation docs demo for outTangent and inTangent… had a middle frame. 🙂

Line 102 - turned OFF loopmode and added a onAnimationEnd callback func.

Line 111 - 114… I guess we need that highly-annoying little function, again. It keeps the camera from working properly… at scene RUN, though. Junk. I don’t know when/how that function suddenly started being “needed”, but it has to go. Core/we need a different way to do that. Comments welcome.

This is related to the issue that @timetocode worked-around in [another cam-animation thread](https://forum.babylonjs.com/t/my-camera-act-like-it-is-detached-from-canvas/447/3).

AND… I changed some keyframe target values… just for fun.

Now it works… almost. Needs some tweaks. Hope this helps. Party on!

---

_[View the full topic](https://forum.babylonjs.com/t/new-camera-position-with-the-animation-transition-to-the-click-of-a-button/561)._
