Search the Community
Showing results for tags 'variables'.
-
Hi Everyone, this is not a animation related question, just wish to get some advices or suggestions to name tweens animation. How do you guys modularise your code or name your variables in terms of code readability. For example, var $object = $('.object'); This allows me to have a quick glance and know this is a jQuery or DOM element. Currently im using something like this, so I can tell it's a animation type var _obj = TweenMax.from($object, 0.6, { autoAlpha: 0, ease: Power1.easeOut }); But I really wish to use the underscore _ as a private method/function identifier. Do you guys prefix your animation var names? Feel free to drop me any suggestion or advice
-
I am using TweenMax to create some small banner ads. The client wants some timed things, no problem. But I'm wondering why in the following code, I have to declare "var pointer" more than once. Why is the initial declaration (is it not a global variable here?) not available to the endseq function? That is, if I remove the var pointer line (in blue) from the endseq function, the code breaks. Stupid question, I know, but JS is not my cup of tea. <script> window.onload = function(){ var pointer = document.getElementById("arrow"); var text = document.getElementById("message"); TweenMax.to(pointer, .8, {x:-30, repeat:6, yoyo:true}); TweenMax.to(text, .8, {repeat:6, border:"2px solid white", yoyo:true, color:"white", onComplete:endseq}); } function endseq(){ var pointer = document.getElementById("arrow"); TweenMax.to(pointer, 1.9, {rotation:360}); TweenMax.to(pointer, .8, {x:-5, repeat:0}); } </script>
- 4 replies
-
- oncomplete
- variables
-
(and 1 more)
Tagged with:
-
in following tween I need to use a var instead of number in transform origin area. I did change the number with a variable but it's not working. TweenMax.to("#gallery", 1,{rotationY:GrotY,opacity:0, transformOrigin:"50% 50% zValue",ease:Power4.easeOut}); as you can see same job works for rotationY value.
-
I'm trying to get an animation to use different property values every time it plays. I've put the values into variables and everything works fine using the default values the first time, but I can't figure out how to get the animation to read the new values that are created when you click a button. var jumpHeight = 100; var jumpTime = 1; var boxcolor = "#00ff00"; var jumpBox = new TweenMax("#redbox", jumpTime, {y:(-jumpHeight), backgroundColor:boxcolor, ease: Power1.easeOut, repeat:1, yoyo:true}); //called when you click a button function rePlay(){ jumpHeight = jumpHeight+24; jumpTime = jumpTime-0.1; boxcolor = "#0000ff"; jumpBox.restart(); } Is there a simple way to do this that I'm missing? This codePen shows a simplified version of what I'm trying to do. http://codepen.io/misterjworth/pen/bdjoLv (The actual project uses multiple tweens within a TimelineMax object that all reference the same variables)
- 3 replies
-
- tweenmax
- timelinemax
-
(and 1 more)
Tagged with:
-
Hello, I'm using Draggable with onDragEnd and onDragStart events to perform some tasks. In order to complete the onDragEnd tasks I need some variables defined inside the onDragStart function be visible inside the onDragEnd function. I see that's the purpose of onDragStartScope but it's not very explicit on how actually do that. Can you clarify this a bit more please? Thank you, your help will be appreciated.
-
Hi All, apologies if this has been asked before but it's causing me a headache. I am trying to provide a tween with variables (which are _x & _y coordinates) so here is my code: if (id == 1) { TweenLite.to(newPic,0.5,{_x:xcoordinate1, _y:ycoordinate1, onComplete:showText, ease:Circ.easeOut}); } else if (id == 2) TweenLite.to(newPic,1,{_x:xcoordinate2, _y:ycoordinate2, onComplete:showText, ease:Circ.easeOut}); { Where I know _x:xcoordinate1 are numbers. My problem is that when I run this code and toggle between these two tweens the values of the variables seems to be ADDED each time so that my image is gradually being pushed off the stage rather than toggle between two positions. (If I trace out the variable after each tween they are as expected but clearly the values are being incremented) I want the movieclip newPic to just move between the two points, does this make sense? Many thanks