Search the Community
Showing results for tags 'roundprops'.
-
Hi, I'm fairly good user of the lib, which i find awesome. thanks I'm having this case right now where i tween a plain numeric value, which i round with the roundProps plugin, and to which i react whenever there's an update with the onUpdate() hook. As the tween runs, the onUpdate() function is fired for every single step on the way, ignoring the fact that the value is rounded in post treatment by the plugin, firing unnecessary onUpdates on the way. Is there a way to prevent that ? Quite simple example : let wrapper = { index: 0, length : 0 }; TweenMax.killAll(); TweenMax.to(wrapper, 2, { length: 10 , roundProps: 'length' , onUpdate: value => { console.log(wrapper.length) } }) Thanks for the help, J.
-
When tweening numbers is there a way to keep it to a certain number of decimal places? Such as in this case: TweenLite.to( numberBeingTweened, 5, { targetNumber: 14.95 }); It's a dollar amount, so I need to keep the two numbers after the decimal. (The title of this post is a bit misleading now that I think about it)
-
Hi, simple question: How can i tell a Draggable that all values during dragging and during throwing are rounded values. During dragging it seams that it uses rounded values already, but when it came to the second part, where a tween for throwing takes control, the values are not rounded anymore. This leads to blurry text or little gaps i.e. between images (translate3D(23.3234233, ...). I know i can request the tween (via draggable.tween), which is created after onDragEnd, but i have no chance to set roundProps to a tween instance which is already created? In my view, the easiest solution would be to have a roundProps-properties to set via the vars-object when creating a Draggable. Draggable.create("#yourID", {type:"x", throwProps:true, roundProps:["x"]}); Thanks.
- 2 replies
-
- draggable
- roundprops
-
(and 2 more)
Tagged with:
-
I am trying to do a rapid cross-fade slideshow (a sort of timelapse effect) and it works as expected so far, but the amount/speed of the images (~300 images @ 2 images/second) that are being loaded are slowing other animations down. Since the opacity is being adjusted down to a very fine level, I figured rounding the number would help the many calls that are happening. I found the roundProps feature and it works as intended, except it becomes pointless when dealing with opacity (will jump straight from 1 to 0). TweenMax.to(obj, 0.5, {autoAlpha:0, roundProps:["opacity"]}); Is there anyway to round to the nearest tenth or hundredth? ... On a similar note, is there any way to adjust the frame rate on an individual timeline? This will change all of the timelines' frame rates: TweenLite.ticker.fps(20); but doesn't work when I try something like: myTimeline.ticker.fps(20);
-
Hi Jack and GS peeps, Help! I'm successfully using this tween below to animate a number gauge up and down depending on the value I pass into condition1a. The problem is when I pull the number in from XML it adds to the value already in the output field instead of sending the gauge to the proper number. I don't know why it acts differently when I pull in from XML. Do I have to tell java the number from XML is a string or somthing? Any ideas? TweenMax.to(obj, .5, {value:condition1a, roundProps:["value"], ease:Linear.easeNone, onUpdate:function() { output.innerHTML = obj.value; output2.innerHTML = obj.value; tl.tweenTo(condition1a); // < this timeline tweens to the correct place, only the output number adds incorrectly. }}); When I set my number gauge value variable like this is works fine: window.condition1a = 27.28; When I pull from XML like shown below its act differently. var scenarioA1=xmlDoc.getElementsByTagName("ThroughputGauge"); window.condition1a = (scenarioA1.getElementsByTagName("scenarioA1")[0].childNodes[0].nodeValue); When I trace the variable is comes up as 27.28 so I know the XML is getting the correct number into the function. alert(condition1a); XML structure sample: <ThroughputGauge> <scenarioA1>27.28</scenarioA1> </ThroughputGauge> How do I get the XML passed variable to act the same as the one I set in java? Thanks everyone!
-
I know Firefox is notorious for having choppy playback. If I'm animating an image down the screen using the "top" property, using roundProps definitely helps make it less jerky. I think Firefox doesn't like things sitting on half-pixel values. How do I accomplish the same thing using the "scale" property? When I try, I think the scale value is properly rounded, but I'm still getting choppy playback. I'm not sure what's going on under the hood, but it seems like even if the scale value is rounded, the item I'm scaling will potentially still have half-pixel values for its width/height/marginLeft/marginRight/top/left (or however it's technically rendered behind the scenes). Anyone have any tips here? Thanks!
-
I know Firefox is notorious for having choppy playback. If I'm animating an image down the screen using the "top" property, using roundProps definitely helps make it less jerky. I think Firefox doesn't like things sitting on half-pixel values. How do I accomplish the same thing using the "scale" property? When I try, I think the scale value is properly rounded, but I'm still getting choppy playback. I'm not sure what's going on under the hood, but it seems like even if the scale value is rounded, the item I'm scaling will potentially still have half-pixel values for its width/height/marginLeft/marginRight/top/left (or however it's technically rendered behind the scenes). Anyone have any tips here? Thanks!
-
Hello I'm trying to tween a value of an object like this: var _obj = {v:0}; TweenMax.to(_obj, 1, {v:100, ease: Linear.easeNone, onUpdate:onTweenUpdate}) } function onTweenUpdate () { console.log(_obj.v) } This works fine but what it actually needs are rounded values. I thought "roundProps" would come in handy but the following change causes an error in TweenMax.js: TweenMax.to(_obj, 1, {v:100, roundProps:"v", ease: Linear.easeNone, onUpdate:onTweenUpdate}) Is this code wrong or does "roundProps" not work that way? What I actually would like to do with it is tweening the "currentAnimationFrame" of an EaselJS BitmapAnimation. I used the "onTweenUpdate" function from the example above together with Math.round() as a workaround. But it would be much nicer to tween the currentAnimationFrame directly. Any ideas anyone? Cheers Henry
- 4 replies
-
- roundProps
- EaselJS
-
(and 2 more)
Tagged with: